lnmp1.1下面多vhost问题
lnmp1.1装完之后做了一点简单的优化,随即添加了5个vhost,添加完后,发现4个vhost工作正常,其中一个vhost访问老是404(原来可以访问,添加到5个vhost之后变得无法访问,配置文件都是自动生成,域名都可以ping通),default原来也可以访问,后面也是变成404,检查日志后,发现都没啥报错
/home/wwwlogs/nginx_error.log,
/home/wwwlogs/access.log,
/usr/local/nginx/logs/errors.log,
/usr/local/php/var/log/php-fpm.log,
检查www.domain.com.log.提示如下:
- - "GET /tz.php HTTP/1.1" 404 56 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko" -
- - "GET /tz.php HTTP/1.1" 404 56 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko" -
- - "GET / HTTP/1.1" 404 56 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko" -
- - "GET / HTTP/1.1" 404 56 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko" -
请问是啥原因呢?
[ 本帖最后由 xdop 于 2014-11-27 19:15 编辑 ] 发报错的配置文件及网站目录情况及权限情况 出错Vhost: oc2.domain.com.conf(最开始可以用)
server
{
listen 80;
#listen [::]:80;
server_name oc2.domain.com;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/oc2.domain.com;
include other.conf;
#error_page 404 /404.html;
location ~ [^/]\.php(/|$)
{
# comment try_files $uri =404; to enable pathinfo
try_files $uri =404;
fastcgi_passunix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
#include pathinfo.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log/home/wwwlogs/oc2.domain.com.logaccess;
}
#wwwroot 文件夹权限情况
# ll
total 20
drwxr-xr-x 15 root root 4096 Nov 27 10:33 zen.domain.com# 可以访问
drwxr-xr-x4 root root 4096 Nov 27 16:21 default #开始可以访问,后来不能访问
drwxrwxrwx8 root root 4096 Nov 27 17:16 oc2.domain.com#开始可以访问,后来不能访问
drwxr-xr-x 15 root root 4096 Nov 27 09:45 test.domain.com# 可以访问
drwxr-xr-x 10 root root 4096 Nov 27 01:50 www.domain.com# 可以访问
#oc2.domain.com 文件夹权限情况 (这是第2个vhost,原来正常访问,添加到5个vhost,重启后,就不能用)
# ll
total 11036
drwxr-xr-x6 root root 4096 Nov 18 14:32 admin
drwxr-xr-x6 root root 4096 Oct1 04:41 catalog
-rwxrwxrwx1 root root 1156 Nov 18 16:07 config.php
-rw-r--r--1 root root 197 Oct1 04:41 crossdomain.xml
drwxrwxrwx6 root root 4096 Oct1 04:41 image
-rwxrwxrwx1 root root 7230 Nov 18 22:46 index.php
drwxr-xr-x6 root root 4096 Oct1 04:41 install
-rw-r--r--1 root root 383 Oct1 04:41 php.ini
drwxr-xr-x 11 root root 4096 Oct1 04:41 system
-rw-r--r--1 root root 11160964 Nov 18 14:32 upload.zip
drwxrwxrwx6 root root 4096 Nov 18 22:47 vqmod
-rwxrwxrwx1 root root 15456 Nov 18 22:39 vqmod-2.5.1-opencart.zip
-rw-r--r--1 root root 56756 Jan22013 pz.php
#default 文件夹权限情况 (原来正常访问,添加到5个vhost,重启后,就不能用)
# ll
total 52
-rw-r--r-- 1 root root 42855 Nov 10 22:06 index.php
drwxr-xr-x 6 root root4096 Jun 182013 xcache
drwxr-xr-x 3 root root4096 Nov 18 15:48 xx
[ 本帖最后由 xdop 于 2014-11-27 21:00 编辑 ] # nginx.conf
userwww www;
worker_processes auto;
error_log/home/wwwlogs/nginx_error.logcrit;
pid /usr/local/nginx/logs/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;
events
{
use epoll;
worker_connections 51200;
multi_accept on;
}
http
{
include mime.types;
default_typeapplication/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 50m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;
gzip on;
gzip_min_length1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE \.";
#limit_conn_zone $binary_remote_addr zone=perip:10m;
##If enable limit_conn_zone,add "limit_conn perip 10;" to server section.
server_tokens off;
#log format
log_formataccess'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
server
{
listen 80 default;
#listen [::]:80 default ipv6only=on;
server_name tz.domain.com;
index index.html index.htm index.php;
root/home/wwwroot/default;
#error_page 404 /404.html;
location ~ [^/]\.php(/|$)
{
# comment try_files $uri =404; to enable pathinfo
try_files $uri =404;
fastcgi_passunix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
#include pathinfo.conf;
}
location /nginx_status {
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log/home/wwwlogs/access.logaccess;
}
include vhost/*.conf;
} 配置文件上没问题,将目录属主改成www
前面你访问的tz.php,目录下也没tz.php 原帖由 licess 于 2014-11-28 12:52 发表 https://bbs.vpser.net/images/common/back.gif
配置文件上没问题,将目录属主改成www
前面你访问的tz.php,目录下也没tz.php
default 目录下访问不了后,就将tz.php改成了index.php 问题找到,原来安装xcache后,在php.ini里边添加xcache的配置时,漏掉了下面两个配置,补充后,重启php-fpm,问题解决。
谢谢军哥。
open_basedir=/home/wwwroot/oc2.domain.com/:/tmp/
open_basedir=/home/wwwroot/oc2.domain.com/:/tmp/
open_basedir=/home/wwwroot/default/:/tmp/
open_basedir=/home/wwwroot/default/:/tmp/
页:
[1]