美文网首页
nginx代理设置

nginx代理设置

作者: 路过的人儿 | 来源:发表于2017-12-09 20:09 被阅读0次

    前段代理转发的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;
        }
    }
    

    相关文章

      网友评论

          本文标题:nginx代理设置

          本文链接:https://www.haomeiwen.com/subject/yiypixtx.html