Nginx隐藏index.php和配置vhost
nginx启动命令
启动:nginx
停止:nginx -s stop
退出:nginx -s quit
重启:nginx -s reopen
重新加载:nginx -s reload
平滑启动:kill -HUP pid(kill -HUP cat /var/run/nginx.pid)
nginx隐藏 index.php,在nginx.conf里添加:
location / {
try_files $uri $uri/ /index.php?$query_string;
}
配置vhost,在nginx.conf的末尾加上:
include vhosts.conf;
然后把网站配置在 vhosts.conf里面,记得不要超出http{}后面那个花括号。模板:
server {
listen 80;
server_name lqawechat.cc;
root /usr/local/nginx/html/qawechat/public;
location / {
index index.php;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
重启nginx,记得在host里添加该地址
vim /etc/hosts
Nginx隐藏index.php和配置vhost的更多相关文章
- nginx 隐藏 index.php 和 开启 pathinfo 模式的配置
nginx 通过 location 的规则匹配将 php 转发给 php-fpm 处理后获取结果然后返回给客户端,转发模式可以通过 unix sock 或 tcp socket 方式.百度了好多文章我 ...
- nginx 隐藏 index.php
使用情景如下: 在访问 http://php.cc/Att/AttList 的时候.跳转到 http://php.cc/index.php/Att/AttList : 也就是开启重写功能: 在ngin ...
- nginx 隐藏index.php 并开启rewrite日志调试(apache也有)
开启rewrite 日志 error_log /data/log/nginx/error.log notice; 位于最外层,大约在文件的前几行 再在http{}括号里增加一行:rewri ...
- lnmp 一键安装包 nginx配置tp5 phpinfo模式 隐藏index.php
tp5 url 线上访问 在nginx 上 出现404错误 那是因为pathinfo没有被支持 修改如下:找到 /usr/local/nginx/config/vhost/项目名.config s ...
- nginx配置隐藏index.php
Nginx 服务器隐藏 index.php 配置 location / { try_files $uri $uri/ /index.php?$query_string; } nginx配置中t ...
- TP5框架 nginx服务器 配置域名 隐藏index.php
server { listen ; #server_name localhost; server_name hhy.com;/**这里写自己的域名*/ #charset koi8-r; #access ...
- Nginx配置PATHINFO隐藏index.php
1.网络来源:http://www.shouce.ren/post/view/id/1529 server { listen 80; default_type text/ ...
- nginx 环境 thinkphp 隐藏index.php
tp官网已经写了 http://doc.thinkphp.cn/manual/hidden_index.html 不生效 重启nginx .问题依旧 kill掉nginx进程 再启动 贴段自己的配置 ...
- nginx服务器去掉url中的index.php 和 配置path_info
隐藏index.php server { listen 80; server_name yourdomain.com; root /home/yourdomain/www/; index index. ...
随机推荐
- leetcode刷题指南
转载自:http://blog.csdn.net/lnho2015/article/details/50962989 以下是我个人做题过程中的一些体会: 1. LeetCode的题库越来越大,截止到目 ...
- golang基础- ElasticSearch搜索引擎、kibana可视化工具、向ES输出数据
转载自:https://blog.csdn.net/u013210620/article/details/78647366 安装ElasticSearch ElasticSearch是一个基于Luce ...
- MFC半透明对话框
int CTestDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CDialog::OnCreate(lpCreateStruct) == -1) ...
- (linux虚拟机)克隆得到的虚拟机修改网卡信息和IP地址,以及DNS
克隆得到的虚拟机,与原先的系统是一模一样的包括MAC地址和IP地址.需要修改成信息. 克隆完事之后,首先在 点击生成一个新的MAC地址.然后启动,登陆. vim /etc/udev/rules.d/7 ...
- 如何避免 await/async 地狱
原文地址:How to escape async/await hell 译文出自:夜色镇歌的个人博客 async/await 把我们从回调地狱中解救了出来,但是如果滥用就会掉进 async/await ...
- css实现背景颜色渐变效果
自己学的一些渐变:background:linear-gradient(90deg,#4EB9E7 -50%,#3691BE 50%,#2E83B0 100%); IE没有效果 详细访问: http: ...
- django项目部署上线
前言 完善的django项目上线,有很多种上线的方法,比如apache, uwsgi, nginx等.这里只介绍2种,一种是django自带的,另外一种则是nginx + uwsgi完成介绍.这里的系 ...
- 一些常用的linux命令(2)
参考:http://www.cnblogs.com/laov/p/3541414.html 系统管理命令 stat 显示指定文件的详细信息,比ls更详细 who ...
- jquery的$.extend和$.fn.extend作用及区别/用span实现进度条/腾讯云IIS端口号修改
jQuery为开发插件提拱了两个方法,分别是: jQuery.fn.extend(); jQuery.extend(); 虽然 javascript 没有明确的类的概念,但是用类来理解它,会更方便. ...
- 快速EDAS字体嵌入问题
在用edas向国际会议投稿的时候,往往要检查pdf稿件的格式,例如页边距.行距.字体等.经常碰到的一个问题就是字体未嵌入到文件中.因为大家一般用CTex里面的ps2pdf生成pdf文件,图片中的字往往 ...