多域名支持(设置域名 www.ci.com)
nginx安装目录 whereis nginx 查看相关信息 php
1.查看nginx配置文件
/etc/nginx/nginx.conf 里面这两个是否被注释(必须开启)
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
2.在sites-enabled或者conf.d 下面新建 ci.conf(ci为域名主体部分)
3.复制 /etc/nginx/sites-available/default 里面的内容 粘贴到ci.conf里面,更改 root 路径就能够。 nginx
4.编辑 /etc/hosts 内容
添加一行 127.0.0.1 www.ci.com
this
5. 重启 nginx
service nginx restart或者 /etc/init.d/nginx restart (非root用户要提权才能运行成功)
spa
6.打开你设置的域名浏览 rest
配置nginx文件夹形式URL(pathinfo)访问支持
只需要在对应的 ci.conf (域名www.ci.com其它域名相似)中
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
添加着色部分就能够。
ci