禁止使用403打开index.php
我使用的是禁止使用403打开index.php,php,nginx,Php,Nginx,我使用的是nginx1.10.1、php5.4.16(fpmfcgi) 我的文件的位置是/usr/share/nginx/html/lab/。在这个目录中,有多个.php文件,包括index.php 如果我把index.html文件放在这个目录中,我可以从http://192.168.201.210:8024/lab/正确。但是如果我删除index.html文件,我只能得到403禁止的 我的php-fam运行良好,我发现很多解决方案对我不起作用: 这是我的nginx的配置文件: http {
nginx1.10.1、php5.4.16(fpmfcgi)
我的文件的位置是/usr/share/nginx/html/lab/
。在这个目录中,有多个.php
文件,包括index.php
如果我把index.html
文件放在这个目录中,我可以从http://192.168.201.210:8024/lab/
正确。但是如果我删除index.html
文件,我只能得到403禁止的
我的php-fam
运行良好,我发现很多解决方案对我不起作用:
这是我的nginx的配置文件:
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
server {
listen 8024; # default_server;
# listen [::]:8024 ipv6only=on default_server;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
location ~* \.php$ {
try_files $uri $uri/ = 404;
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
index index.php index.html;
}
}
}
您可以检查日志文件以获取一些信息
tail-n50/var/log/nginx/access.log
您知道403吗,php fpm是否正确访问web路径,
如
chmod755-R/usr/share/nginx/html/lab/
您可以查看日志文件以获取一些信息
tail-n50/var/log/nginx/access.log
您知道403吗,php fpm是否正确访问web路径,
像
chmod755-R/usr/share/nginx/html/lab/
最后我找到了原因:我有另一个django应用程序在同一个端口监听-8024。如果我删除django应用程序的配置文件或将nginx的配置文件修改为
listen 8024 default_server;
然后,我可以很好地访问index.php。但我无法在同一端口访问我的django应用程序
这里有一个关于在nginx中配置php的非常好的教程:最后我找到了原因:我有另一个django应用程序在同一个端口上侦听-8024。如果我删除django应用程序的配置文件或将nginx的配置文件修改为
listen 8024 default_server;
然后,我可以很好地访问index.php。但我无法在同一端口访问我的django应用程序
这里有一个关于在nginx中配置php的非常好的教程:没有access.log,我仍然感到惊讶。即使我为所有文件授予
777
权限,它仍然不起作用。如果我访问http://192.168.201.210:8024/lab/index.php
我可以直接下载此文件,但我无法在浏览器中看到它。没有access.log,我仍然感到惊讶。即使我为所有文件授予777
权限,它仍然不起作用。如果我访问http://192.168.201.210:8024/lab/index.php
我可以直接下载这个文件,但我在浏览器中看不到它。在您的catch all位置/
中是否需要index指令(index index index.php
)?在catch all位置/
中是否需要index指令(index index.php
)?