Nginx之常用操作
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之常用操作的更多相关文章
- CentOS + Nginx 的常用操作指令总结
CentOS + Nginx 的常用操作指令总结 一. 关于CentOS 查看 yum 源是否存在 yum list | grep nginx 如果不存在 或者 不是自己想要的版本 可以自己设置Ngi ...
- ubuntu下nginx的常用操作
1.安装不多说了,我是使用apt-get进行安装的,直接键入 apt-get install nginx 2.启动nginx. 首先找到nginx的主运行程序(相当于windows下的nginx.ex ...
- Ubuntu安装设置nginx和nohup常用操作
nginx安装 Ubuntu直接从常规源中安装 apt-get install nginx 安装的目录 配置文件:/etc/nginx/ 主程序文件:/usr/sbin/nginx Web默认目录:/ ...
- Linux - nginx基础及常用操作
目录 Linux - nginx基础及常用操作 Tengine淘宝nginx安装流程 nginx的主配置文件nginx.conf 基于域名的多虚拟主机实战 nginx的访问日志功能 网站的404页面优 ...
- KVM虚拟化管理 virt manager常用操作
部分涉及到Linux.Nginx.tomcat.MySQL等的点滴操作记录,时间长了,就忘掉了,偶尔整理一下操作的history,就此简要备份一下: [原][BG]-一次虚拟化环境实践简要记录: ht ...
- Docker 基础概念科普 和 常用操作介绍
Docker 基础概念 Docker是什么? Docker的思想来自于集装箱,集装箱解决了:在一艘大船上,可以把货物规整的摆放起来.并且各种各样的货物被集装箱标准化了,集装箱和集装箱之 ...
- [容器]docker-ce安装最新版-docker常用操作
社区: http://www.dockerinfo.net/rancher http://dockone.io/ https://www.kubernetes.org.cn/ 1,docker安装配置 ...
- legend3---lamp.sh常用操作
legend3---lamp.sh常用操作 一.总结 一句话总结: 1.github上下载代码 2.修改项目数据库配置,修改文件权限等操作:chown -R apache:apache /data/w ...
- legend3---Homestead常用操作代码
legend3---Homestead常用操作代码 一.总结 一句话总结: 在虚拟机里面改变文件windows里面也会变,在windows里面改变虚拟机里面也会变,所以可以在windows里面编程或者 ...
随机推荐
- 微服务一键启动脚本shell没有环境变量的
#!/bin/bash#######################################################export JAVA_HOME=/root/data/app/jd ...
- OGG 从Oracle备库同步数据至kafka
OGG 从Oracle备库同步数据至kafka Table of Contents 1. 目的 2. 环境及规划 3. 安装配置JDK 3.1. 安装jdk 3.2. 配置环境变量 4. 安装Data ...
- vim 软件
1. 安装vim 2. 使用vim 操作模式: 1. 一般模式 ,默认进入的一般模式,该模式不能编辑文档 ,只能查看 按 i(insert) ...
- Ceph RBD 的实现原理与常规操作
目录 文章目录 目录 前文列表 RBD RBD Pool 的创建与删除 块设备的创建与删除 块设备的挂载与卸载 新建客户端 块设备的扩缩容 RBD 块设备的 Format 1 VS Format 2 ...
- Redis ==> 集群的三种模式
一.主从同步/复制 通过持久化功能,Redis保证了即使在服务器重启的情况下也不会丢失(或少量丢失)数据,因为持久化会把内存中数据保存到硬盘上,重启会从硬盘上加载数据. 但是由于数据是存储在一台服务器 ...
- IPv4正则表达式
apache common-httpclient-4.5.2.jar package org.apache.http.conn.util; public class InetAddressUtils ...
- C基础知识(11):错误处理
C语言不提供对错误处理的直接支持,但是作为一种系统编程语言,它以返回值的形式允许您访问底层数据.在发生错误时,大多数的C或UNIX函数调用返回1或NULL,同时会设置一个错误代码errno,该错误代码 ...
- Servlet(3):Cookie
概念 Cookie是存储在客户端计算机上的文本文件,并保留了各种跟踪信息.Java Servlet支持HTTP Cookie. 识别返回用户包括三个步骤: (1) 服务器脚本向浏览器发送一组Cooki ...
- 安装IE11必备更新
https://support.microsoft.com/zh-cn/help/2847882
- app测试自动化之混合APP(之前的三篇为原生APP的操作)
混合开发的App中,经常会有内嵌的H5页面:定位方法与原生APP不同,需要上下文切换 #获取所有上下文contexts=dr.contextsprint(contexts)#打印当前上下文(有点问题应 ...