前段代理转发的NGINX简单配置示例
server {
listen 80;
listen [::]:80;
server_name m.mqphp.com;
root /mnt/www/sell;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php$is_args$args;
add_header 'Access-Control-Allow-Origin' *;
}
location ~ \.php {
try_files $uri /index.php =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index /index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
#设置代理转发 只要为m.mqphp.com/sell/xxx的路径
#均会被自动代理到docker.mqphp.com/sell/sell/xxx上去
location /sell/ {
proxy_pass http://docker.mqphp.com:8080;
}
}
网友评论