适用场景:利用一个Nginx,即可把Java、PHP、Python等项目统一起来。
下面的代码意思就是说,如果你访问 http://pic.example.top,就等同于访问 http://xxx.xx.xx.xx:8041。
upstream flow_server {
server 127.0.0.1:8041;
}
server {
listen 80;
server_name pic.example.top;
# root /var/www/smpp;
#location /smpp {
# add_header Access-Control-Allow-Origin *;
# add_header Access-Control-Allow-Headers X-Requested-With;
# add_header Access-Control-Allow-Methods GET,POST,OPTOPNS;
#
# 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;
#}
location / {
proxy_pass http://127.0.0.1:8041;
index index.html;
try_files /index.html =404;
}
location = /favicon.ico {
try_files $uri $uri/;
}
}