# 给你的网站起一个域名 > jenny.com 下面是nginx配置 ``` server { listen 80; server_name jenny.com szh.free.idcfengye.com; root "/home/szh/myapp/public"; location / { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_redirect off; add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,X-Requested-With'; add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS'; if (!-e $request_filename) { proxy_pass http://127.0.0.1:3000; } if (!-f $request_filename) { proxy_pass http://127.0.0.1:3000; } } access_log /var/log/nginx/access-jenny.log; error_log /var/log/nginx/error-jenny.log; } ``` 将上述代码保存为jenny.com.conf 拷贝到nginx配置目录 ``` sudo cp jenny.com.conf /etc/nginx/sites-enabled/ sudo nginx -s reload ``` # 配置windows hosts文件 **(C:\Windows\System32\drivers\etc\hosts)** ![](https://img.kancloud.cn/03/d3/03d3c41d214cf619d9bdd95ff4b431fc_482x72.png) # 在浏览器中访问 ![](https://img.kancloud.cn/c1/09/c109ddaa6034fa2f890089b7c99df294_417x125.png)