VPS侦探论坛

标题: lnmp1.7 安装YII2.0 服务器无法访问 [打印本页]

作者: Joe.Fang    时间: 2020-5-10 00:17
标题: lnmp1.7 安装YII2.0 服务器无法访问
显示截图:


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

  8.         include rewrite/yii2.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-pathinfo.conf;

  13.         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  14.         {
  15.             expires      30d;
  16.         }

  17.         location ~ .*\.(js|css)?$
  18.         {
  19.             expires      12h;
  20.         }

  21.         location ~ /.well-known {
  22.             allow all;
  23.         }

  24.         location ~ /\.
  25.         {
  26.             deny all;
  27.         }

  28.         access_log  /home/wwwlogs/yii.com.log;
  29.     }

  30. server
  31.     {
  32.         listen 443 ssl http2;
  33.         #listen [::]:443 ssl http2;
  34.         server_name yii.com;
  35.         index index.html index.htm index.php default.html default.htm default.php;
  36.         root  /home/wwwroot/web;

  37.         ssl_certificate /usr/local/public/yii.com.crt;
  38.         ssl_certificate_key /usr/local/public/yii.com.key;
  39.         ssl_session_timeout 5m;
  40.         ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
  41.         ssl_prefer_server_ciphers on;
  42.         ssl_ciphers "TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
  43.         ssl_session_cache builtin:1000 shared:SSL:10m;
  44.         # openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
  45.         ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;

  46.         include rewrite/yii2.conf;
  47.         #error_page   404   /404.html;

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

  50.         include enable-php.conf;

  51.         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  52.         {
  53.             expires      30d;
  54.         }

  55.         location ~ .*\.(js|css)?$
  56.         {
  57.             expires      12h;
  58.         }

  59.         location ~ /.well-known {
  60.             allow all;
  61.         }

  62.         location ~ /\.
  63.         {
  64.             deny all;
  65.         }

  66.         access_log  /home/wwwlogs/yii.com.log;
  67.     }
复制代码



作者: Joe.Fang    时间: 2020-5-10 00:18
本帖最后由 Joe.Fang 于 2020-5-10 00:19 编辑


修改: include enable-php-pathinfo.conf;  ==> include enable-php.conf;
其他的没修改过,

作者: licess    时间: 2020-5-10 09:38
先排查一下防跨目录设置
如果还不行,按常见问题开启php错误日志
作者: Joe.Fang    时间: 2020-5-10 21:00
licess 发表于 2020-5-10 09:38
先排查一下防跨目录设置
如果还不行,按常见问题开启php错误日志

感谢,已解决, 注释掉一项, 路径:/usr/local/nginx/conf/fastcgi.conf

应该是在最后一行

  1. fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";
复制代码

  1. 添加网站的时候, 是修改的/home/wwwroot/default ==> 网站目录名, 创建号之后在更改文件夹名字, 然后西创建网站目录名
  2. /home/wwwroot/web ==>/home/wwwroot/123
  3. 新建:
  4. /home/wwwroot/web
复制代码






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