新建“項目名.conf”文件,拷貝以下內(nèi)容到文件,注意修改server_name和alias目錄。
upstream tornadoes {
? ? server 127.0.0.1:8080;? # 修改為自己項目的端口
? ? keepalive 16;
}
server {
? ? listen 80;
? ? server_name 111.111.111.111;? #需要修改為自己的域名戓IP
? ? location ^~ /static {
? ? ? ? alias /www/wwwroot/xxx/applications/statics; #修改為自己的項目名
? ? ? ? if ($query_string) {
? ? ? ? ? ? expires max;
? ? ? ? }
? ? }
? ? location / {
? ? ? ? proxy_pass_header Server;
? ? ? ? proxy_set_header Host $http_host;
? ? ? ? proxy_redirect off;
? ? ? ? proxy_set_header X-Real-IP $remote_addr;
? ? ? ? # 協(xié)議 http https
? ? ? ? proxy_set_header X-Scheme $scheme;
? ? ? ? # Suport WebSocket
? ? ? ? proxy_http_version 1.1;
? ? ? ? proxy_set_header Upgrade $http_upgrade;
? ? ? ? proxy_set_header Connection "upgrade";
? ? ? ? proxy_pass http://tornadoes;
? ? }
}