【已解决-结帖】军哥帮忙:LNMP0.8绑定多域名多站点不稳定
安装了LNMP0.8,并按教程配置了多站点域名分别绑定到不同的目录,想要实现VPS上 单IP 多域名 多站点
域名一 www.a.com 绑定目录 /home/wwwroot/a
域名二 www.b.com 绑定目录 /home/wwwroot/b
错误现象:时常会出现打开俩域名后,发现内容串了,比如域名一打开后显示了域名二的内容之类的,要么就是域名一正常,域名二却显示 LNMP安装成功的页面,而我已经将 /home/wwwroot/ 目录下的 Index.html 文件删除了(此文件为LNMP安装成功页面)
俩域名正常的情况也有,但时常会出现串内容或访问结果为LNMP成功页面!!
自己处理过程:
1、 /usr/local/nginx/sbin/nginx -t 结果显示正常
the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
configuration file /usr/local/nginx/conf/nginx.conf test is successful
2、/root/lnmp restart 或 reboot 结果也正常
nginx、php、mysql等都正常启动!
域名一:/usr/local/nginx/conf/vhost/a.conf
server
{
listen 80;
server_name www.a.com;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/a;
include none.conf;
location ~ .*\.(php|php5)?$
{
fastcgi_passunix:/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;
}
域名二:/usr/local/nginx/conf/vhost/b.conf
server
{
listen 80;
server_name www.b.com;
index index.html index.htm index.php default.html default.htm default.php;
root/home/wwwroot/b;
include none.conf;
location ~ .*\.(php|php5)?$
{
fastcgi_passunix:/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;
}
/usr/local/nginx/conf/nginx.conf的内容如下:
userwww www;
worker_processes 1;
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;
}
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;
#limit_zonecrawler$binary_remote_addr10m;
server
{
listen 80;
server_name vps.a.com;
index index.html index.htm index.php;
root/home/wwwroot;
location ~ .*\.(php|php5)?$
{
fastcgi_passunix:/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_formataccess'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log/home/wwwlogs/access.logaccess;
}
include vhost/*.conf;
}
注:vps 为单IP
[ 本帖最后由 haibor 于 2012-1-3 22:07 编辑 ] 有了解的木,给点解决意见呗 多域名多站点都不行,还玩个屁啊。楼主贴个球代码,自己用vhost.sh添加网站,不行就见鬼了 已解决!原因不在VPS配置!真扯蛋!
结帖!!! 原帖由 haibor 于 2012-1-3 22:05 发表 https://bbs.vpser.net/images/common/back.gif
已解决!原因不在VPS配置!真扯蛋!
结帖!!! 是什么问题 我也出现这样的问题 这个正确,但是我刚换了lnmpa,多域名就有些问题 在安装的时候,主目录,也就是/home/wwwroot 也需要放在一个vhost的配置文件中,这样就没问题了。 这样啊,晕得很啊。。我也是这个情况。。我去试试。。
页:
[1]