首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >用nginx新加一个虚拟主机,不能解析php?

用nginx新加一个虚拟主机,不能解析php?

提问于 2017-03-04 22:58:22
回答 1关注 0查看 710

原本我服务器里面只有一个网站,刚才修改Nginx.conf 新加一个网站。解析正常之后,访问html文件可正常解析然后访问php文件,就会直接弹出下载框,下载这个php文件.大神帮忙看看代码哪儿有错。95-112是我添加的代码。谢谢code#user www www;worker_processes 1;#error_log logs/error.log;#error_log logs/error.log notice;#error_log logs/error.log info;#pid logs/nginx.pid;events { worker_connections 1024;}http { include mime.types; default_type application/octet-stream; #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 logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root /data/www; index index.php index.htm index.html; }location /phpmyadmin { alias /data/www/phpmyadmin; index index.php;}location ~ /phpmyadmin/.+.php$ { if ($fastcgi_script_name ~ /phpmyadmin/(.+.php.*)$) { set $valid_fastcgi_script_name $1; }include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /data/www/phpmyadmin/$valid_fastcgi_script_name;} #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ .php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ .php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /.ht { # deny all; #} }

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档