我在Windows上使用WPM-XM堆栈。我在本地主机环境中使用两个php项目pcm,pcx。
我希望pcm项目使用pcm.conf文件。但我并不喜欢这样做。这是pcm.conf文件的内容:
server {
# access from localhost only
listen 127.0.0.1:80;
server_name localhost/pcm;
# the following default "catch-all" configuration, allows access to the server from outside.
# please ensure your firewall allows access to tcp/port 80. check your "skype" config.
# listen 80;
# server_name _;
log_not_found off;
charset utf-8;
access_log logs/pcm.log main;
error_log logs/pcme.log;
# handle files in the root path /www
location / {
root /www/pcm;
index index.php index.html index.htm;
}
#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 www;
}
location /pcxxc/ {
deny all;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass php;
fastcgi_index index.php;
#fastcgi_param PHP_FCGI_MAX_REQUESTS 1000;
#fastcgi_param PHP_FCGI_CHILDREN 100;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param REMOTE_ADDR $http_x_real_ip;
include fastcgi_params;
}
# add expire headers and speed up image access with a vary header
location ~* ^.+.(gif|ico|jpg|jpeg|png|flv|swf|pdf|mp3|mp4|xml|txt|js|css)$ {
expires 30d;
add_header Vary Accept-Encoding;
}
# only allow these request methods
if ($request_method !~ ^(GET|HEAD|POST)$ ){ return 405; }
# deny access to .htaccess files (if Apache's document root concurs with nginx's one)
# deny access to git & svn repositories
location ~ /(\.ht|\.git|\.svn) {
access_log off;
log_not_found off;
deny all;
}
}
}
我正在尝试访问url localhost / pcm / pcxxc /以检查配置文件是否正常工作。而不是显示访问被拒绝/您没有访问文件错误的权限。 Nginx报告404找不到错误。
保存上述配置文件的文件夹已添加到主nginx配置文件
中如何正确设置Nginx(Windows)中多个项目的配置文件?
答案 0 :(得分:0)
/pcm/pcxxc/
请求与您的location /
匹配,/www/pcm/pcm/pcxxc/
尝试在目录\wamp\bin\apache\apache{version}\conf\extra\httpd-vhosts.conf
下提供某些索引文件并失败。