VPS侦探论坛

标题: lnmp 反向代理如何配置??? [打印本页]

作者: bobofan1995    时间: 2018-4-6 12:24
标题: lnmp 反向代理如何配置???
请问nginx反向代理其他网站如何配置,总是提示404
[attach]4988[/attach]



  1. server
  2.     {
  3.         listen 80;
  4.         #listen [::]:80;
  5.         server_name abc.com www.abc.com;
  6.         index index.html index.htm index.php default.html default.htm default.php;
  7.         #root  /home/wwwroot/abc.com;

  8.         include none.conf;
  9.         #error_page   404   /404.html;

  10.         # Deny access to PHP files in specific directory
  11.         #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

  12.         include enable-php.conf;


  13.         location / {
  14.             proxy_pass   http://example.com/;#要代理的url
  15.                 index  index.html index.htm;
  16.         }
  17.         #location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  18.         #{
  19.         #    expires      30d;
  20.         #}

  21.         #location ~ .*\.(js|css)?$
  22.         #{
  23.         #    expires      12h;
  24.         #}

  25.         #location ~ /.well-known {
  26.         #    allow all;
  27.         #}

  28.         #location ~ /\.
  29.         #{
  30.         #    deny all;
  31.         #}

  32.         access_log off;
  33.     }
复制代码

[ 本帖最后由 bobofan1995 于 2018-4-6 12:50 编辑 ]
作者: licess    时间: 2018-4-6 13:44
https://www.vpser.net 上搜索反向代理 就有教程
弄个反代你加上include enable-php.conf;干啥




欢迎光临 VPS侦探论坛 (https://bbs.lnmp.com/) Powered by Discuz! X3.4