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的更多相关文章

  1. nginx 隐藏 index.php 和 开启 pathinfo 模式的配置

    nginx 通过 location 的规则匹配将 php 转发给 php-fpm 处理后获取结果然后返回给客户端,转发模式可以通过 unix sock 或 tcp socket 方式.百度了好多文章我 ...

  2. nginx 隐藏 index.php

    使用情景如下: 在访问 http://php.cc/Att/AttList 的时候.跳转到 http://php.cc/index.php/Att/AttList : 也就是开启重写功能: 在ngin ...

  3. nginx 隐藏index.php 并开启rewrite日志调试(apache也有)

    开启rewrite 日志 error_log       /data/log/nginx/error.log notice; 位于最外层,大约在文件的前几行 再在http{}括号里增加一行:rewri ...

  4. lnmp 一键安装包 nginx配置tp5 phpinfo模式 隐藏index.php

    tp5 url 线上访问 在nginx 上 出现404错误 那是因为pathinfo没有被支持 修改如下:找到   /usr/local/nginx/config/vhost/项目名.config s ...

  5. nginx配置隐藏index.php

    Nginx 服务器隐藏 index.php 配置   location / { try_files $uri $uri/ /index.php?$query_string; }   nginx配置中t ...

  6. TP5框架 nginx服务器 配置域名 隐藏index.php

    server { listen ; #server_name localhost; server_name hhy.com;/**这里写自己的域名*/ #charset koi8-r; #access ...

  7. Nginx配置PATHINFO隐藏index.php

    1.网络来源:http://www.shouce.ren/post/view/id/1529 server {      listen       80;     default_type text/ ...

  8. nginx 环境 thinkphp 隐藏index.php

    tp官网已经写了 http://doc.thinkphp.cn/manual/hidden_index.html 不生效 重启nginx .问题依旧 kill掉nginx进程  再启动 贴段自己的配置 ...

  9. nginx服务器去掉url中的index.php 和 配置path_info

    隐藏index.php server { listen 80; server_name yourdomain.com; root /home/yourdomain/www/; index index. ...

随机推荐

  1. java程序的内存分配(一)

      首 页 阅览室 馆友 我的图书馆 帐号 java程序的内存分配(一) 收藏  JAVA 文件编译执行与虚拟机(JVM)介绍  Java 虚拟机(JVM)是可运行Java代码的假想计算机.只要根据J ...

  2. AS3编程规范

    整理了一些AS3的编程规范,有些规则对于大部分语言都是适用的,有什么问题请提出来,我会持续改进这份规范,谢谢!   [参考资料] 1.http://opensource.adobe.com/wiki/ ...

  3. App免费推广途径概要

    说在前面的话:免费其实挺花功夫的,所有的营销的前提是产品和服务是值得推荐的. 1.技术操作维度:ASO,SEO, ASO简单介绍:http://baike.baidu.com/subview/1368 ...

  4. mysql高级之编程优化

    ★编程优化一.字符编码(mysql控制台乱码输出解决:character_set_results='gbk')表/列编码设置  列:alter table 表名 change 列名 列名 数据类型 c ...

  5. Java获取当日的起始时间,结束时间,现在时间,是否在时间段中。

    当日的起始时间 public static Date getTodayStartTime() { Calendar todayStart = Calendar.getInstance(); today ...

  6. 利用Python进行数据分析

    最近在阅读<利用Python进行数据分析>,本篇博文作为读书笔记 ,记录一下阅读书签和实践心得. 准备工作 python环境配置好了,可以参见我之前的博文<基于Python的数据分析 ...

  7. MVC5 框架 配置 盘古分词

    2018.5.10日记 1.将sql数据库的内容添加到索引库中, public static readonly IndexManager instance; //静态构造函数,CLR只执行一次 sta ...

  8. ubantu和虚拟机tools 安装 小问题集结

    一.虚拟机 就安装虚拟机而言,个人觉得还是比较简易的,毕竟VMware workstation pro 是一个开源的软件,只要在网上搜索即可,这里我提供一个虚拟机的资源: 链接:http://pan. ...

  9. 洛谷 P1069 解题报告

    P1069 细胞分裂 题目描述 \(Hanks\)博士是\(BT\) (\(Bio-Tech\),生物技术) 领域的知名专家.现在,他正在为一个细胞实验做准备工作:培养细胞样本. \(Hanks\) ...

  10. URL 规范 整理

    URL 规范 不用大写:(强制) 用中杠-不用下杠_:(强制) 参数列表要encode,编码使用utf-8:(强制) URI中的名词表示资源集合,使用复数形式.(建议) 增加版本号(建议) URI中统 ...