我正在尝试使用基本的master / catch-all vhost配置来设置我的开发Nginx /
PHP服务器,以便我可以根据需要使用
created unlimited
___.framework.loc
domains.
server { listen 80; index index.html index.htm index.PHP; # Test 1 server_name ~^(.+)\.frameworks\.loc$; set $file_path $1; root /var/www/frameworks/$file_path/public; include /etc/Nginx/PHP.conf; }
但是,对于此设置,Nginx会响应404错误.我知道Nginx和PHP正在工作并拥有权限,因为我使用的localhost配置工作正常.
server { listen 80 default; server_name localhost; root /var/www/localhost; index index.html index.htm index.PHP; include /etc/Nginx/PHP.conf; }
我应该检查什么来找到问题?这是他们都加载的PHP.conf的副本.
location / { try_files $uri $uri/ /index.PHP$is_args$args; } location ~ \.PHP${ try_files $uri =404; include fastcgi_params; fastcgi_index index.PHP; # Keep these parameters for compatibility with old PHP scripts using them. fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # Some default config fastcgi_connect_timeout 20; fastcgi_send_timeout 180; fastcgi_read_timeout 180; fastcgi_buffer_size 128k; fastcgi_buffers 4 256k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; fastcgi_intercept_errors on; fastcgi_ignore_client_abort off; fastcgi_pass 127.0.0.1:9000; }
为什么不使用:
server_name *.frameworks.loc; root /var/www/frameworks/$http_host/public;