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. c#调用野狗云 rest api

    野狗云就不多介绍了,这里主要是记录一下c#调用他们提供的rest api,把数据post到野狗云存储,直接上代码 static void Main(string[] args) { string st ...

  2. Swap Nodes in Pairs(交换节点)

    Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2-&g ...

  3. 二叉查找树之 Java的实现

    参考:http://www.cnblogs.com/skywang12345/p/3576452.html 二叉查找树简介 二叉查找树(Binary Search Tree),又被称为二叉搜索树.它是 ...

  4. balanced binary tree(判断是否是平衡二叉树)

    Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary ...

  5. Vi 操作命令

    进入vi的命令  vi filename :打开或新建文件,并将光标置于第一行首  vi +n filename :打开文件,并将光标置于第n行首  vi + filename :打开文件,并将光标置 ...

  6. tomcat启动非常慢;连接oracle数据库失败,jdbc错误日志提示connection reset;测试主机间网络互通及数据库端口都正常

      [判断确认:这时候大家可能要去检查一下/dev/random 这个设备档案.可以用cat /dev/random 来看它的内容,如果你发现他一直没显示任何内容﹝可能是乱码数字之类的﹞,那就是它出问 ...

  7. 网易面经(Java开发岗)

    网易面经(Java岗) 网易两面面经整理 岗位:我投递的是杭研所的Java开发岗位.行程:半天的时间南京=杭州之间穿行,单程2个小时,从杭州东站=网易大厦,单程1个小时(如果能买到城站高铁动车票可以从 ...

  8. 基于Cloudera Search设计数据灾备方案

    当实际项目上线到生产环境中,难以避免一些意外情况,如数据丢失.服务器停机等.对于系统的搜索服务来说,当遇到停机的情况意味着在停机这段时间内,用户都不能通过搜索的相关功能进行访问数据,停机意味着将这一段 ...

  9. Lintcode401 Kth Smallest Number in Sorted Matrix solution 题解

    [题目描述] Find the kth smallest number in at row and column sorted matrix. 在一个排序矩阵中找从小到大的第 k 个整数. 排序矩阵的 ...

  10. 局部内部类访问它所在方法的局部变量时,要求该局部变量必须声明为final的原因

    这是java的一条规则.那么为什么会有这条规则呢?要想弄懂这个问题,就需要弄懂局部内部类对象和局部变量的生命周期的谁更长的问题. 首先,看一段代码,以没有将变量声明为final的代码作为例子,代码如下 ...