1) 将XXX.com 重定向到 www.XXX.com

server {
client_max_body_size 20m;
listen ;
server_name www.xxx.com xxx.com;
access_log /data/varlog/nginx/xxx.log main;
error_log /data/varlog/nginx/xxx_err.log error;
root /data/wwwroot/web/xxx/public;
index index.php index.html index.htm;
if ($http_host = xxx.com) {
rewrite (.*) http://www.xxx.com;
}
location / {
try_files $uri $uri/ /index.php?_url=$uri&$args;
}
gzip on; error_page /.html;
error_page /50x.html;
location = /50x.html {
} location ~ \.php$ {
try_files $uri =; fastcgi_pass 127.0.0.1:;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /usr/local/openresty/nginx/conf/fastcgi_params;
} location ~ /\.ht {
deny all;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
access_log off;
}
}

  2)重启NGINX

sudo nginx -c /etc/conf/nginx.conf -t ; 验证NGINX配置
sudo nginx -c /etc/conf/nginx.conf -s reload ;重启NGINX服务

  3)NGINX常用命令

nginx -h 查看帮助
nginx version: openresty/1.11.2.5
Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives] Options:
-?,-h : this help
-v : show version and exit
-V : show version and configure options then exit
-t : test configuration and exit
-T : test configuration, dump it and exit
-q : suppress non-error messages during configuration testing
-s signal : send signal to a master process: stop, quit, reopen, reload
-p prefix : set prefix path (default: /usr/local/openresty/nginx/)
-c filename : set configuration file (default: conf/nginx.conf)
-g directives : set global directives out of configuration file

Nginx之常用操作的更多相关文章

  1. CentOS + Nginx 的常用操作指令总结

    CentOS + Nginx 的常用操作指令总结 一. 关于CentOS 查看 yum 源是否存在 yum list | grep nginx 如果不存在 或者 不是自己想要的版本 可以自己设置Ngi ...

  2. ubuntu下nginx的常用操作

    1.安装不多说了,我是使用apt-get进行安装的,直接键入 apt-get install nginx 2.启动nginx. 首先找到nginx的主运行程序(相当于windows下的nginx.ex ...

  3. Ubuntu安装设置nginx和nohup常用操作

    nginx安装 Ubuntu直接从常规源中安装 apt-get install nginx 安装的目录 配置文件:/etc/nginx/ 主程序文件:/usr/sbin/nginx Web默认目录:/ ...

  4. Linux - nginx基础及常用操作

    目录 Linux - nginx基础及常用操作 Tengine淘宝nginx安装流程 nginx的主配置文件nginx.conf 基于域名的多虚拟主机实战 nginx的访问日志功能 网站的404页面优 ...

  5. KVM虚拟化管理 virt manager常用操作

    部分涉及到Linux.Nginx.tomcat.MySQL等的点滴操作记录,时间长了,就忘掉了,偶尔整理一下操作的history,就此简要备份一下: [原][BG]-一次虚拟化环境实践简要记录: ht ...

  6. Docker 基础概念科普 和 常用操作介绍

    Docker 基础概念 Docker是什么?         Docker的思想来自于集装箱,集装箱解决了:在一艘大船上,可以把货物规整的摆放起来.并且各种各样的货物被集装箱标准化了,集装箱和集装箱之 ...

  7. [容器]docker-ce安装最新版-docker常用操作

    社区: http://www.dockerinfo.net/rancher http://dockone.io/ https://www.kubernetes.org.cn/ 1,docker安装配置 ...

  8. legend3---lamp.sh常用操作

    legend3---lamp.sh常用操作 一.总结 一句话总结: 1.github上下载代码 2.修改项目数据库配置,修改文件权限等操作:chown -R apache:apache /data/w ...

  9. legend3---Homestead常用操作代码

    legend3---Homestead常用操作代码 一.总结 一句话总结: 在虚拟机里面改变文件windows里面也会变,在windows里面改变虚拟机里面也会变,所以可以在windows里面编程或者 ...

随机推荐

  1. Centos7 yum install chrome

    一.配置 yun 源 vim /etc/yum.repos.d/google-chrome.repo [google-chrome] name=google-chrome baseurl=http:/ ...

  2. BitmapRegionDecoder

    Android加载大图——BitmapRegionDecoder(转)   BitmapRegionDecoder,从API10就引入了.如下图:   NPONRY0T35GE$13{254X8Z1. ...

  3. Appium移动自动化测试(二)之appuim + 夜神模拟器

    环境搭建起来之后, 就可以开始移动自动化了. 但是使用自带的AVD开启模拟器, 速度实在太慢. 于是用夜神来做替代, 稍微能够有一些提速. 启动appuim 打开Appium,点击右上角Start按钮 ...

  4. jenkins凭证与新建任务

    一.凭证介绍 有许多第三方网站和应用程序可以与 Jenkins 进行交互,例如程序代码仓库,云存储系统和服务等. 此类应用程序的系统管理员可以在应用程序中配置凭证以专供 Jenkins 使用.通常通过 ...

  5. python中接受上一条命令执行的结果----subprocess.check_output()

    subprocess.call 是不能作为赋值的,需要用到 subprocess.check_output 函数,而且如果要引用赋值就必须使用subprocess.call(['echo',line] ...

  6. Squirrel GUI+ Phoenix 连接Hbase

    一. 参考 http://blog.csdn.net/maomaosi2009/article/details/45598823 二. 问题解决 >Squirrel Client Connect ...

  7. Java ——注释 命名

    注释 1.类在每个类前面必须加上类注释,注释模板如下:/*** Copyright (C), 2006-2010, ChengDu Lovo info. Co., Ltd.* FileName: Te ...

  8. 【HANA系列】SAP HANA SQL截取字符串

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[HANA系列]SAP HANA SQL截取字符 ...

  9. pt-online-schema-change 修改表结构

  10. python 爬虫 目录

    爬虫 介绍 python 爬虫 urllib模块 python 爬虫 requests模块