VPS侦探论坛
标题:
【求助】vhost新建虚拟主机问题
[打印本页]
作者:
ql2005
时间:
2010-8-4 16:35
标题:
【求助】vhost新建虚拟主机问题
主域名为abc.com 目录是默认的/home/wwwroot
用vhost新建了一个虚拟主机 xx.abc.com 目录是 /home/wwwroot/xx.abc.com
然后访问php文件的时候报错 No input file specified.
直接访问html文件 错误404
然后发现访问xx.abc.com/p.php 读取的是wwwroot里的p.php ...
就是说 xx.abc.com并没有访问 /home/wwwroot/xx.abc.com 这个目录,而是访问/home/wwwroot 什么原因呢。。。
看过几个conf文件 路径应该都没错阿。。
作者:
licess
时间:
2010-8-4 17:44
标题:
回复 1# 的帖子
别猜了,贴配置文件吧。
/usr/local/nginx/conf/nginx.conf 和/usr/local/nginx/conf/vhost/ 下面域名.conf 的文件。
作者:
ql2005
时间:
2010-8-4 20:55
实际的域名我作了替换
nginx.conf
user www www;
worker_processes 1;
error_log /home/wwwroot/logs/nginx_error.log crit;
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;
}
http
{
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
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_length 1k;
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;
#limit_zone crawler $binary_remote_addr 10m;
server
{
listen 80;
server_name abc.com;
index index.html index.htm index.php;
root /home/wwwroot;
location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location /status {
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
log_format access '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log /home/wwwroot/logs/access.log access;
}
include vhost/*.conf;
}
复制代码
xxx.abc.com.conf
server
{
listen 80;
server_name xxx.abc.com;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/xxx.abc.com;
include none.conf;
location ~ .*\.(php|php5)?$
{
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log off;
}
复制代码
作者:
ql2005
时间:
2010-8-4 21:01
下面这个 一开始是root xxx.abc.com; 后来我改成 root /home/wwwroot/xxx.abc.com; 还是不行。。
nginx刚接触,都不是很明白~
作者:
licess
时间:
2010-8-5 10:24
标题:
回复 4# 的帖子
重启nginx没有,重启后才会生效。
作者:
ql2005
时间:
2010-8-5 10:32
标题:
回复 5# 的帖子
=.= 肯定重启阿...
重启了好几次了都这样。。
我也怀疑到底有没真正的重启
感觉怎么改都跟没改一样
作者:
licess
时间:
2010-8-5 10:40
标题:
回复 6# 的帖子
配置是没有问题,发重启时候的信息。
作者:
ql2005
时间:
2010-8-5 10:41
又加了个试试
感觉虚拟主机跟没加一样。。。。
访问的还是wwwroot
作者:
ql2005
时间:
2010-8-5 10:45
[root@localhost lnmp0.4-full]# ./vhost.sh
=========================================================================
Add Virtual Host for LNMP V0.4 , Written by Licess
=========================================================================
LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux
This script is a tool to add virtual host for nginx
For more information please visit http://www.lnmp.org/
=========================================================================
Please input domain:
(Default domain: www.lnmp.org):pp.abc.com
===========================
domain=pp.abc.com
===========================
Do you want to add more domain name? (y/n)
n
Please input the directory for the domain:pp.abc.com :
(Default directory: /home/wwwroot/pp.abc.com):
===========================
Virtual Host Directory=/home/wwwroot/pp.abc.com
===========================
===========================
Allow Rewrite rule? (y/n)
===========================
n
===========================
You choose rewrite=none
===========================
===========================
Allow access_log? (y/n)
===========================
n
===========================
You access log file=.log
===========================
Press any key to start create virtul host...
Create Virtul Host directory......
set permissions of Virtual Host directory......
You select the exist rewrite rule:/usr/local/nginx/conf/none.conf
Test Nginx configure file......
the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
configuration file /usr/local/nginx/conf/nginx.conf test is successful
Restart Nginx......
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
=========================================================================
Add Virtual Host for LNMP V0.4 , Written by Licess
=========================================================================
For more information please visit http://www.lnmp.org/
Your domain:pp.abc.com
Directory of pp.abc.com:/home/wwwroot/pp.abc.com
=========================================================================
You have new mail in /var/mail/root
[root@localhost lnmp0.4-full]# ./lnmp restart
=========================================================================
Manager for LNMP V0.4 , Written by Licess
=========================================================================
LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux
This script is a tool to Manage status of lnmp
For more information please visit http://www.lnmp.org
Usage: /root/lnmp {start|stop|reload|restart|kill|status}
=========================================================================
Reload LNMP...
Reload Nginx configure...
the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
configuration file /usr/local/nginx/conf/nginx.conf test is successful
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
Nginx program is reloding!
Shutting down MySQL. [确定]
Starting MySQL. [确定]
Shutting down php_fpm . done
Starting php_fpm done
复制代码
作者:
zjttfs
时间:
2010-8-5 13:33
楼主试试重启vps
我开始和楼主一样 重启一次vps就好了
作者:
ql2005
时间:
2010-8-5 13:44
标题:
回复 10# 的帖子
恩。。我机器重启下试试
没用VPS 直接就是刚装上centos5.5的服务器
作者:
zjttfs
时间:
2010-8-5 13:57
原帖由
ql2005
于 2010-8-5 13:44 发表
恩。。我机器重启下试试
没用VPS 直接就是刚装上centos5.5的服务器
很好很强大~
作者:
ql2005
时间:
2010-8-5 14:45
果然重启可以了。。。吐血
那就是说 ./lnmp restart 没有重启nginx?
要是以后加一个虚拟主机就要重启整台服务器一次。。。。 会死人的。。
[
本帖最后由 ql2005 于 2010-8-5 14:48 编辑
]
作者:
ql2005
时间:
2010-8-5 16:19
/usr/local/nginx/sbin/nginx -s reload 貌似这样可以平滑重启nginx配置
作者:
licess
时间:
2010-8-5 16:36
标题:
回复 13# 的帖子
/root//lnmp restart 这个测试过,没有问题
作者:
ql2005
时间:
2010-8-5 19:49
标题:
回复 15# 的帖子
囧
那什么原因?
9#是我新建虚拟主机
重启的整个过程
为什么虚拟主机没有生效
整台服务器重启了才可以...
麻烦军哥帮忙看下.
THX
作者:
licess
时间:
2010-8-5 22:21
标题:
回复 16# 的帖子
不知道你注意到你重启的时候“kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]”
有着一个提示了,就是因为他导致的。
作者:
ql2005
时间:
2010-8-6 10:45
标题:
回复 17# 的帖子
.。。。
不懂这行什么意思。。。。
作者:
ql2005
时间:
2010-8-6 14:32
现在新建又没问题。。重启的时候也没出现刚才那样的。。
无语...
欢迎光临 VPS侦探论坛 (https://bbs.lnmp.com/)
Powered by Discuz! X3.4