VPS侦探论坛

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

伪静态求助军哥

[复制链接]
发表于 2018-7-2 18:28:29 | 显示全部楼层 |阅读模式

伪静态求助军哥环境LNMP   PHP7.1
安装的程序为https://github.com/cydrobolt/polr/
根据这个程序的docs 需要填写的nginx配置文件是
  1. # HTTPS

  2. #server {
  3. #   listen              *:443 ssl;
  4. #   ssl_certificate     /etc/ssl/my.crt;
  5. #   ssl_certificate_key /etc/ssl/private/my.key;
  6. #   root                /var/www/polr/public;
  7. #   index index.php index.html index.htm;
  8. #   server_name         example.com;
  9. #
  10. #   location / {
  11. #           try_files $uri $uri/ /index.php$is_args$args;
  12. #           # rewrite ^/([a-zA-Z0-9]+)/?$ /index.php?$1;
  13. #   }
  14. #
  15. #   location ~ \.php$ {
  16. #           try_files $uri =404;
  17. #           include /etc/nginx/fastcgi_params;
  18. #
  19. #           fastcgi_pass    php;
  20. #           fastcgi_index   index.php;
  21. #           fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
  22. #           fastcgi_param   HTTP_HOST       $server_name;
  23. #   }
  24. #}
复制代码




其中的伪静态是
  1. location / {
  2. try_files $uri $uri/ /index.php$is_args$args;
  3. # rewrite ^/([a-zA-Z0-9]+)/?$ /index.php?$1;
  4. }
复制代码




我在对应的虚拟主机添加为如下
  1. server
  2.     {
  3.         listen 443 ssl;
  4.         #listen [::]:80;
  5.         server_name 81pla.cn ;
  6.         index index.html index.htm index.php default.html default.htm default.php;
  7.         root  /home/wwwroot/81pla.cn/public;
  8.         ssl_certificate /home/cert/short.pem;
  9.         ssl_certificate_key /home/cert/short.key;
  10.         ssl_ciphers "EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
  11.         ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  12.         ssl_prefer_server_ciphers on;
  13.         ssl_session_cache shared:SSL:10m;
  14.                 add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";

  15.         include none.conf;
  16.         #error_page   404   /404.html;

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



  19.         include enable-php.conf;
  20.         location / {
  21.            try_files $uri $uri/ /index.php$is_args$args;
  22.            # rewrite ^/([a-zA-Z0-9]+)/?$ /index.php?$1;
  23.         }
  24.         

  25.         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  26.         {
  27.             expires      30d;
  28.         }

  29.         location ~ .*\.(js|css)?$
  30.         {
  31.             expires      12h;
  32.         }

  33.         location ~ /.well-known {
  34.             allow all;
  35.         }

  36.         location ~ /\.
  37.         {
  38.             deny all;
  39.         }

  40.         access_log off;
  41.     }
复制代码


但是访问好像是无法生效的!显示500错误,,伪静态这块我添加的对吗?
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2018-7-2 18:55:12 | 显示全部楼层


好像伪静态是没问题的 500的问题 开了日志是  openbase的问题
  1. Warning: require(): open_basedir restriction in effect. File(/home/wwwroot/81pla.cn/bootstrap/app.php) is not within the allowed path(s): (/home/wwwroot/81pla.cn/public/:/tmp/:/proc/) in /home/wwwroot/81pla.cn/public/index.php on line 14
复制代码
nginx里的root  /home/wwwroot/81pla.cn/public;


我已经把user.ini  修改了
  1. open_basedir=/home/wwwroot/81pla.cn:/tmp/:/proc/
复制代码





为什么还不可以  重启过
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2018-7-2 19:22:50 | 显示全部楼层

修改过.user.ini了   访问还是提示 not allowed /home/wwwroot/81pla.cn/public/:/tmp/:/proc、、、

不知道这个public哪里冒出来的
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2018-7-2 19:27:17 | 显示全部楼层



LNMP 1.4上如果不想用防跨目录或者修改.user.ini的防跨目录的目录还需要将 /usr/local/nginx/conf/fastcgi.conf 里面的fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/"; 在该行行前添加 # 或删除改行,需要重启nginx。

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

本版积分规则

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

GMT+8, 2024-9-23 23:35 , Processed in 0.026411 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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