新建一个配置文件
vim www.ti3.cc.conf
输入以下配置
listen 80;server_name localhost www.ti3.cc ti3.cc;location / {proxy_pass http://localhost:9000;proxy_redirect default;}}
wq 保存,重载Nginx
service nginx reload
结果改进版:
创建一个配置文件(以www.ti3.cc为例)
vim www.ti3.cc.conf
输入一下配置
server{listen 80;server_name www.ti3.cc;location /{proxy_redirect off;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_pass http://localhost:9000;}location ~ .\.(php|jsp|cgi|asp|aspx|flv|swf|xml)?${proxy_set_header Host $host;proxy_set_header X-Forwarded-For $remote_addr;proxy_pass http://localhost:9000;}access_log /www/wwwlogs/ti3.cc.log;}
wq保存