以下是我的配置文件:
server
{
listen 80;
server_name www.zgf890213.com www.zgf5277.com www.zgf527714.com
index index.html index.htm index.php;
root /data/www/www1;
access_log /tmp/access.log zgf890213;
if ($host != 'www.zgf890213.com')
{
rewrite ^/(.*)$ www.zgf890213.com/$1 permanent;
}
location ~ .*admin\.php$ {
auth_basic "aminglinux auth";
auth_basic_user_file /usr/local/nginx/conf/.htpasswd;
include fastcgi_params;
fastcgi_pass unix:/tmp/www.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www/www1$fastcgi_script_name;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/tmp/www.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www/www1$fastcgi_script_name;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
access_log off;
valid_referers none blocked *.zgf890213.com *.zgf5277.com *.zgf527714.com ;
if ($invalid_referer)
{
return 403;
}
}
location ~ .*\.(js|css)?$
{
expires 12h;
access_log off;
}
}
请问配置i文件哪里写错了~?报403错误!
server
{
listen 80;
server_name www.zgf890213.com www.zgf5277.com www.zgf527714.com
index index.html index.htm index.php;
root /data/www/www1;
access_log /tmp/access.log zgf890213;
if ($host != 'www.zgf890213.com')
{
rewrite ^/(.*)$ www.zgf890213.com/$1 permanent;
}
location ~ .*admin\.php$ {
auth_basic "aminglinux auth";
auth_basic_user_file /usr/local/nginx/conf/.htpasswd;
include fastcgi_params;
fastcgi_pass unix:/tmp/www.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www/www1$fastcgi_script_name;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/tmp/www.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www/www1$fastcgi_script_name;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
access_log off;
valid_referers none blocked *.zgf890213.com *.zgf5277.com *.zgf527714.com ;
if ($invalid_referer)
{
return 403;
}
}
location ~ .*\.(js|css)?$
{
expires 12h;
access_log off;
}
}
请问配置i文件哪里写错了~?报403错误!
0
1.把你配置文件备份 ,然后只留前半部分试试。
2.你的域名www.zgf890213.com无法访问,如果只能局域网访问,不如写成www.aaa.com ,避免大伙误解
server
{
listen 80;
server_name www.zgf890213.com www.zgf5277.com www.zgf527714.com
index index.html index.htm index.php;
root /data/www/www1;
access_log /tmp/access.log zgf890213;
if ($host != 'www.zgf890213.com')
{
rewrite ^/(.*)$ www.zgf890213.com/$1 permanent;
}
2.你的域名www.zgf890213.com无法访问,如果只能局域网访问,不如写成www.aaa.com ,避免大伙误解
server
{
listen 80;
server_name www.zgf890213.com www.zgf5277.com www.zgf527714.com
index index.html index.htm index.php;
root /data/www/www1;
access_log /tmp/access.log zgf890213;
if ($host != 'www.zgf890213.com')
{
rewrite ^/(.*)$ www.zgf890213.com/$1 permanent;
}
编辑回复