伪静态求助军哥
伪静态求助军哥环境LNMP PHP7.1安装的程序为https://github.com/cydrobolt/polr/
根据这个程序的docs 需要填写的nginx配置文件是
# HTTPS
#server {
# listen *:443 ssl;
# ssl_certificate /etc/ssl/my.crt;
# ssl_certificate_key /etc/ssl/private/my.key;
# root /var/www/polr/public;
# index index.php index.html index.htm;
# server_name example.com;
#
# location / {
# try_files $uri $uri/ /index.php$is_args$args;
# # rewrite ^/(+)/?$ /index.php?$1;
# }
#
# location ~ \.php$ {
# try_files $uri =404;
# include /etc/nginx/fastcgi_params;
#
# fastcgi_pass php;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_param HTTP_HOST $server_name;
# }
#}
其中的伪静态是
location / {
try_files $uri $uri/ /index.php$is_args$args;
# rewrite ^/(+)/?$ /index.php?$1;
}
我在对应的虚拟主机添加为如下
server
{
listen 443 ssl;
#listen [::]:80;
server_name 81pla.cn ;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/81pla.cn/public;
ssl_certificate /home/cert/short.pem;
ssl_certificate_key /home/cert/short.key;
ssl_ciphers "EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
include none.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php.conf;
location / {
try_files $uri $uri/ /index.php$is_args$args;
# rewrite ^/(+)/?$ /index.php?$1;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log off;
}
但是访问好像是无法生效的!显示500错误,,伪静态这块我添加的对吗? 好像伪静态是没问题的 500的问题 开了日志是openbase的问题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 14nginx里的root/home/wwwroot/81pla.cn/public;
我已经把user.ini修改了
open_basedir=/home/wwwroot/81pla.cn:/tmp/:/proc/
为什么还不可以重启过 修改过.user.ini了 访问还是提示 not allowed /home/wwwroot/81pla.cn/public/:/tmp/:/proc、、、
不知道这个public哪里冒出来的 LNMP 1.4上如果不想用防跨目录或者修改.user.ini的防跨目录的目录还需要将 /usr/local/nginx/conf/fastcgi.conf 里面的fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/"; 在该行行前添加 # 或删除改行,需要重启nginx。
按照这个解决了
页:
[1]