- 积分
- 2
- 威望
-
- 金钱
-
- 注册时间
- 2015-11-18
- 在线时间
- 小时
- 最后登录
- 1970-1-1
|
这个是添加虚拟主机的操作:
[root@xxxxxxxxx]# lnmp vhost add
+-------------------------------------------+
| Manager for LNMP, Written by Licess |
+-------------------------------------------+
| http://lnmp.org |
+-------------------------------------------+
Please enter domain(example: www.lnmp.org): www.xxx.com
======================================
Your domain: www.xxx.com
======================================
Do you want to add more domain name? (y/n) y
Enter domain name(example: lnmp.org *.lnmp.org): xxx.com
domain list: xxx.com
Please enter the directory for the domain: www.xxx.com
Virtual Host Directory: /home/wwwroot/www.xxx.com
===========================
(Default directory: /home/wwwroot/www.xxx.com):
Allow Rewrite rule? (y/n)
===========================
y
Please enter the rewrite of programme:
wordpress,discuz,typecho,sablog,dabr rewrite was exist.
(Default rewrite: other):zsbry
===========================
You choose rewrite=zsbry
===========================
===========================
Allow access_log? (y/n)
===========================
n
======================================================
Create database and MySQL user with same name (y/n)
======================================================
n
Press any key to start create virtul host...
Create Virtul Host directory......
set permissions of Virtual Host directory......
Create Virtul Host ReWrite file......
Create rewirte file successful,You can add rewrite rule into /usr/local/nginx/conf/zsbry.conf.
Gracefully shutting down php-fpm . done
Starting php-fpm done
Test Nginx configure file......
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
Restart Nginx......
================================================
Virtualhost infomation:
Your domain: www.xxx.com
Home Directory: /home/wwwroot/www.xxx.com
Rewrite: xxx
Enable log: no
Create database: no
Create ftp account: no
================================================
下面的是server的配置:
server
{
listen 80;
#listen [::]:80;
server_name www.xxx.com xxx.com;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/www.xxx.com;
include zsbry.conf;
#error_page 404 /404.html;
location ~ [^/]\.php(/|$)
{
# comment try_files $uri =404; to enable pathinfo
try_files $uri =404;
fastcgi_pass unix:/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 off;
}
这个是按照http://lnmp.org/faq/lnmp-nginx-301-rewrite.html
server {
listen 80;
server_name lnmp.org;
return 301 http://www.lnmp.org$request_uri;
}
按这个操作不带www的不会301到带www的,是不是哪里配置错了啊?
请军哥帮忙看下,谢谢!!! |
|