配置了两个在本机的端口,81 82 但是82的访问却跟81一样,路径什么的虽然有设置,却无效;
另外,access_log logs/mainhost.access.log ;不能在;号前+main,加了就报错...
设定的设定查看Nginx状态的地址 也失效了...
(windows 0.9.4)
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#access_log logs/access.log main;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
#gzip_vary on;
limit_zone one $binary_remote_addr 10m;
#默认虚拟主机
server {
listen 81;
server_name localhost;
charset utf-8;
access_log logs/mainhost.access.log ;
location / {
root d:/web/php;
index index.html index.htm index.php;
}
location ^~ /a/ {
proxy_pass http://localhost:81;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
}
#设定查看Nginx状态的地址
location /NginxStatus {
stub_status on;
access_log on;
auth_basic "NginxStatus";
}
#错误日志
error_log logs/server_error.log error;
#指定404错误页面,不得大于512字节
#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 d:/web/php;
#禁用404错误日志,可以禁止nginx记录找不到robots.txt 和 favicon.ico 这类文件的错误信息。
log_not_found off;
}
#将客户端的请求转交给fastcgi
location ~ .*\.(php|php5)?$ {
#location ~ \.php$ {
# root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME d:/web/php$fastcgi_script_name;
include fastcgi_params;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 15d;
}
location ~ .*\.(js|css)?$
{
expires 1d;
}
}
#phpwindbbs配置
server {
listen 82;
server_name localhost:82;
charset utf-8;
access_log logs/phpwindbbsaccess.log ;
location / {
root D:/web/php/phpwind/bbs;
index index.html index.htm index.php;
}
location ^~ /a/ {
proxy_pass http://localhost:82;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
}
error_log logs/phpwindbbs_error.log error;
location ~ .*\.(php|php5)?$ {
root D:/web/php/phpwind/bbs;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME D:/web/php/phpwind/bbs$fastcgi_script_name;
include fastcgi_params;
}
}
}
另外,我把上述82的server配置保存成文件,然后
include D:\nginx\nginx-0.9.4\conf\phpwindbbs.conf
结果nginx直接就无法运行了,提示 unexpected "}" 可我看了{}都是对应的啊
还有,就算我用了这个配置: http://localhost:82/phpwind/bbs/install.php 访问,结果样式全部丢失了.... 82端口
还有,我开启了autoindex on;,结果看起来似乎是正确的,但是当我点击某个目录时又不对了...我到底哪里错了T)T
晕,这么久了没有人回复我T_T