|
新增虚拟主机:(以下方法仅限在 nginx 服务器下有效)
一、解析域名
二、绑定域名
1、找到nginx 服务器的虚拟主机配置文件夹,如:/alidata/server/nginx/conf/vhosts
2、在里面新增一个配置文件并按照如下格式编辑文件,如myweb.conf:
- server {
- listen 80;
- server_name myweb.wm987.com;
- index index.html index.htm index.php;
- root /onemary/www/myweb;
- location ~ .*\.(php|php5)?$
- {
- #fastcgi_pass unix:/tmp/php-cgi.sock;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- include fastcgi.conf;
- }
- location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
- {
- expires 30d;
- }
- location ~ .*\.(js|css)?$
- {
- expires 1h;
- }
- #伪静态配置
- include /onemary/server/nginx/conf/rewrite/myweb.conf;
- access_log /onemary/log/nginx/access/wedding016.log;
- }
复制代码
备注:
server_name 要绑定的域名,多个域名用空额分隔即可
root 网站根目录路径
URL重写规则配置文件路径 /onemary/server/nginx/conf/rewrite/discuz_x3.conf、
三、重启服务器
/etc/init.d/nginx reload
四、创建对应的网站目录
mkdir /onemary/www/myweb
五、修改网站目录文件夹的权限为web/FTP授权权限如 www
chown -R www.www /onemary/www/myweb
-------------------------------------------------------------
附加:
常用 VIM文本编辑器 命令
打开/创建文件: vim 文件名
进入编辑状态:i
退出:q
强行退出:q!
保存是:w
强制保存:w!
|
|