VPS侦探论坛

 找回密码
 注册
查看: 3124|回复: 3

lnmp1.7 安装YII2.0 服务器无法访问

[复制链接]
发表于 2020-5-10 00:17:17 | 显示全部楼层 |阅读模式

显示截图:


  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.     }
复制代码


美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2020-5-10 00:18:37 | 显示全部楼层


本帖最后由 Joe.Fang 于 2020-5-10 00:19 编辑


修改: include enable-php-pathinfo.conf;  ==> include enable-php.conf;
其他的没修改过,
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2020-5-10 09:38:13 | 显示全部楼层

先排查一下防跨目录设置
如果还不行,按常见问题开启php错误日志
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2020-5-10 21:00:04 | 显示全部楼层



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
复制代码

Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-21 17:50 , Processed in 0.029518 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表