nginx多站点配置,以及隐藏index.php
来源:互联网 发布:淮南市大数据技能大赛 编辑:程序博客网 时间:2024/06/01 09:36
一、nginx多站点的配置
1、默认安装的nginx在/etc/nginx下,则执行以下命令
sudo mkdir /etc/nginx/conf.d
这个conf.d作为我们放置多站点的目录
图中的admin.conf和api.conf就是我们新建的配置文件
2、在配置文件中写入你的网站配置
server { listen 80; server_name 你的域名,比如testA; root 网站的根目录; index index.php index.html; if (!-e $request_filename) { rewrite ^/(.*) /index.php/$1 last; } location ~* \.php { fastcgi_pass unix:/var/run/php5-fpm.sock; # fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; include fastcgi_params; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ~ /\.git { deny all; }}
如上即是testA网站的配置,这里只需要修改root路径为项目根目录,然后写上域名即可。
3、多站点配置文件完成之后,需要在总配置处引入一下多站点配置
(1)cd /etc/nginx
(2)vim nginx.conf
(3)
4、最后记得重启一下nginx服务,即可访问你所配置的站点
sudo service nginx restart
二、配置文件中隐藏index.php
if (!-e $request_filename) { rewrite ^/(.*) /index.php/$1 last; }
上面这句代码即可
end
阅读全文
1 0
- nginx多站点配置,以及隐藏index.php
- Nginx配置 隐藏入口文件index.php
- Nginx 服务器隐藏 index.php 配置
- nginx 隐藏index.php
- thinkphp的nginx配置,以及重写隐藏index.php入口文件
- Nginx PHP多站点配置
- Nginx隐藏index.php和Pathinfo模式配置例子
- nginx配置pathinfo模式和隐藏index.php
- centos7 thinphp5 Nginx隐藏index.php和Pathinfo模式配置
- Nginx配置隐藏index.php和PATH_INFO支持
- Nginx配置隐藏index.php和PATH_INFO支持
- Nginx隐藏index.php和Pathinfo模式配置例子
- nginx pathinfo 并隐藏index.php
- nginx 隐藏index.php 支持PATHINFO
- thinkphp 隐藏index.php iis apache nginx
- wamp;phpstudy nginx隐藏index.php
- nginx重写url隐藏index.php
- Nginx 隐藏入口文件 index.php
- 数组中重复的数字
- 设计模式 -- 原型模式
- Oracle物化视图创建
- ubuntu 17 安装 nginx php mysql
- 软件工程(C编码实践篇)学习总结
- nginx多站点配置,以及隐藏index.php
- python圣斗士修炼(十四):关于时间处理
- 学习C++程序设计需要什么基础
- Django 快速搭建博客 第五节(hello world模板视图)
- java内存区域与内存溢出异常
- 训练日记
- Node.js 参数的接收
- Matlab 2017b MinGW-w64 5.3安装
- 注意力提高神经回路的突触功效和信噪比(Farran Briggs, George R. Mangun& W. Martin Usrey)