Home >Backend Development >PHP Tutorial >nginx配置PHP异常(静态文件可访问,php不行)

nginx配置PHP异常(静态文件可访问,php不行)

WBOY
WBOYOriginal
2016-06-13 11:44:561365browse

nginx配置PHP错误(静态文件可访问,php不行)
如题。
我做的是nginx多端口多域名配置
192.168.0.28:100/index.html #访问正常
192.168.0.28:100/a.php #访问错误505
配置文件内容如下:
文件/usr/local/nginx/nginx.conf

<br />user  www www;<br /><br />worker_processes 1;<br /><br />error_log  /home/wwwlogs/nginx_error.log  crit;<br /><br />pid        /usr/local/nginx/logs/nginx.pid;<br /><br />#Specifies the value for maximum file descriptors that can be opened by this process.<br />worker_rlimit_nofile 51200;<br /><br />events<br />	{<br />		use epoll;<br />		worker_connections 51200;<br />	}<br /><br />http<br />	{<br />		include       mime.types;<br />		default_type  application/octet-stream;<br /><br />		server_names_hash_bucket_size 128;<br />		client_header_buffer_size 32k;<br />		large_client_header_buffers 4 32k;<br />		client_max_body_size 50m;<br /><br />		sendfile on;<br />		tcp_nopush     on;<br /><br />		keepalive_timeout 60;<br /><br />		tcp_nodelay on;<br /><br />		fastcgi_connect_timeout 300;<br />		fastcgi_send_timeout 300;<br />		fastcgi_read_timeout 300;<br />		fastcgi_buffer_size 64k;<br />		fastcgi_buffers 4 64k;<br />		fastcgi_busy_buffers_size 128k;<br />		fastcgi_temp_file_write_size 256k;<br /><br />		gzip on;<br />		gzip_min_length  1k;<br />		gzip_buffers     4 16k;<br />		gzip_http_version 1.0;<br />		gzip_comp_level 2;<br />		gzip_types       text/plain application/x-javascript text/css application/xml;<br />		gzip_vary on;<br />		gzip_proxied        expired no-cache no-store private auth;<br />		gzip_disable        "MSIE [1-6]\.";<br /><br />		#limit_zone  crawler  $binary_remote_addr  10m;<br /><br />		server_tokens off;<br />		#log format<br />		log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '<br />             '$status $body_bytes_sent "$http_referer" '<br />             '"$http_user_agent" $http_x_forwarded_for';<br /><br />server<br />	{<br />		listen       80;<br />		server_name www.lnmp.org;<br />		index index.html index.htm index.php;<br />		root  /home/wwwroot/default;<br /><br />		location ~ .*\.(php|php5)?$<br />			{<br />				try_files $uri =404;<br />				fastcgi_pass  unix:/tmp/php-cgi.sock;<br />				fastcgi_index index.php;<br />				include fcgi.conf;<br />			}<br /><br />		location /status {<br />			stub_status on;<br />			access_log   off;<br />		}<br /><br />		location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$<br />			{<br />				expires      30d;<br />			}<br /><br />		location ~ .*\.(js|css)?$<br />			{<br />				expires      12h;<br />			}<br /><br />		access_log  /home/wwwlogs/access.log  access;<br />	}<br />include vhost/*.conf;<br />}<br /><br /><br />


文件/usr/local/nginx/vhost/a.1010.com.conf
server {  <br />    listen 1010;  <br />    server_name a.1010.com;  <br />    location / { <br />      root  /home/wwwroot/default/a;<br />      index index.html index.htm index.php;  <br />    }<br />        location ~ ^(.+\.php)(.*)$ {<br />                        fastcgi_index index.php;<br />                        fastcgi_split_path_info ^(.+\.php)(.*)$;<br />                        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br />                        fastcgi_param PATH_INFO $fastcgi_path_info;<br />                        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;<br />                        fastcgi_pass 127.0.0.1:9000;<br />                        include fcgi.conf;<br />                }<br /><br />}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn