访问虚拟服务器403,openresty访问虚拟主机出现403 Forbidden怎么解决?

nginx.conf文件配置如下:

user www www;

worker_processes auto;

error_log /data/wwwlogs/error_nginx.log crit;

pid /var/run/nginx.pid;

worker_rlimit_nofile 51200;

events {

use epoll;

worker_connections 51200;

multi_accept on;

}

http {

include mime.types;

default_type application/octet-stream;

server_names_hash_bucket_size 128;

client_header_buffer_size 32k;

large_client_header_buffers 4 32k;

client_max_body_size 1024m;

client_body_buffer_size 10m;

sendfile on;

tcp_nopush on;

keepalive_timeout 120;

server_tokens off;

tcp_nodelay on;

fastcgi_connect_timeout 300;

fastcgi_send_timeout 300;

fastcgi_read_timeout 300;

fastcgi_buffer_size 64k;

fastcgi_buffers 4 64k;

fastcgi_busy_buffers_size 128k;

fastcgi_temp_file_write_size 128k;

fastcgi_intercept_errors on;

#Gzip Compression

gzip on;

gzip_buffers 16 8k;

gzip_comp_level 6;

gzip_http_version 1.1;

gzip_min_length 256;

gzip_proxied any;

gzip_vary on;

gzip_types

text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml

text/javascript application/javascript application/x-javascript

text/x-json application/json application/x-web-app-manifest+json

text/css text/plain text/x-component

font/opentype application/x-font-ttf application/vnd.ms-fontobject

image/x-icon;

gzip_disable "MSIE [1-6]\.(?!.*SV1)";

#If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency.

open_file_cache max=1000 inactive=20s;

open_file_cache_valid 30s;

open_file_cache_min_uses 2;

open_file_cache_errors on;

######################## default ############################

server {

listen 80;

server_name _;

access_log /data/wwwlogs/access_nginx.log combined;

root /data/wwwroot/default;

index index.html index.htm index.php;

#error_page 404 /404.html;

#error_page 502 /502.html;

location /nginx_status {

stub_status on;

access_log off;

allow 127.0.0.1;

deny all;

}

location ~ [^/]\.php(/|$) {

#fastcgi_pass remote_php_ip:9000;

fastcgi_pass unix:/dev/shm/php-cgi.sock;

fastcgi_index index.php;

include fastcgi.conf;

}

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {

expires 30d;

access_log off;

}

location ~ .*\.(js|css)?$ {

expires 7d;

access_log off;

}

location ~ /\.ht {

deny all;

}

}

########################## vhost #############################

include vhost/*.conf;

########################## WAF #############################

lua_shared_dict limit 10m;

lua_package_path "/usr/local/openresty/nginx/conf/waf/?.lua";

init_by_lua_file "/usr/local/openresty/nginx/conf/waf/init.lua";

access_by_lua_file "/usr/local/openresty/nginx/conf/waf/waf.lua";

}

IP访问是正常的,但是域名对应的虚拟主机就不行,我给wwwroot下面的虚拟主机目录权限为755还是不行,请问怎么解决这个问题呢?

刚刚发现,上传index.html可以显示,但是index.php不能显示,上面配置都写了呀,为什么php是403呢?

如果我访问www.域名.com/index.php,结果是下载这个文件,请问怎么设置才能正确访问index.php呢?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值