nginx指定配制文件
nginx启动:
未指定配制文件:
./nginx 指定配制文件:
/usr/local/nginx/sbin/nginx -c /home/deploy/nginx-wz/conf/nginx.conf
nginx重启
./nginx -s reload
验证nginx.conf是否正确
./nginx -t nginx -t -c /usr/local/nginx/conf/nginx.conf
Nginx安装:
:安装插件:
yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
:下载并解压到指定目录:
wget http://nginx.org/download/nginx-1.15.5.tar.gz
tar -zxvf nginx-1.15..tar.gz
cd nginx-1.15./
:配制nginx
a:默认配置
./configure
b:自定义配置
./configure \
--prefix=/usr/local/nginx \
--conf-path=/usr/local/nginx/conf/nginx.conf \
--pid-path=/usr/local/nginx/conf/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scg
c:支持https
./configure --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/nginx.conf --with-http_ssl_module
:编译安装
make
make install
、设置nginx开机并启动,添加到系统服务
vi /etc/init.d/nginx
#!/bin/sh
# chkconfig:
# Startup script for the nginx Web Server
# description: nginx is a World Wide Web server.
# It is used to serve HTML files and CGI.
# processname: nginx
# pidfile: /usr/local/nginx/logs/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="nginx deamon"
NAME=nginx
DAEMON=/usr/local/nginx/sbin/$NAME
SCRIPTNAME=/etc/init.d/$NAME test -x $DAEMON || exit d_start(){
$DAEMON || echo -n "already running"
} d_stop(){
$DAEMON -s quit || echo -n "not running"
} d_reload(){
$DAEMON -s reload || echo -n "can not reload"
} case "$1" in
start)
echo -n "Starting $DESC: $NAME"
d_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
d_stop
echo "."
;;
reload)
echo -n "Reloading $DESC conf..."
d_reload
echo "reload ."
;;
restart)
echo -n "Restarting $DESC: $NAME"
d_stop
sleep
d_start
echo "."
;;
*)
echo "Usage: $ScRIPTNAME {start|stop|reload|restart}" >&
exit
;;
esac exit
:添加开机启动并配制权限
# 给启动文件添加执行权限
chmod +x /etc/init.d/nginx # 添加开机自动启动nginx服务
chkconfig --add nginx # 修改服务启动设置
chkconfig nginx on/off # 显示开机可以自动启动的服务
chkconfig --list nginx
nginx :off :off :on :on :on :on :off
nginx指定配制文件的更多相关文章
- nginx root&alias文件路径配置
转:https://www.ttlsa.com/nginx/nginx-root_alias-file-path-configuration/ 总结: alias 改变了访问路径.root对应loca ...
- nginx root && alias 文件路径配置
文章摘自:http://www.ttlsa.com/nginx/nginx-root_alias-file-path-configuration/ nginx指定文件路径有两种方式root和alias ...
- 限定某个目录禁止解析php 、限制user_agent 、php的配制文件、PHP的动态扩展模块
1. 限定某个目录禁止解析php(有些目录用户可以上传文件或图片,可能会被恶意者上传其它文件):编辑:/usr/local/apache2.4/conf/extra/httpd-vhosts.conf ...
- nginx root&alias 文件路径配置
nginx 指定文件路径有两种方式 root 和 alias,root 与 alias 主要区别在于 nginx 如何解释 location 后面的 uri,这会使两者分别以不同的方式将请求映射到服务 ...
- nginx访问静态文件配置
通过nginx访问静态文件配置,均是在server模块中配置,有两种方式: 1.alias 通过alias关键字,重定义路径,如 server{ listen 7001; server ...
- Nginx 配置详细文件
概述 Nginx 是使用一个 master 进程来管理多个 worker 进程提供服务.master 负责管理 worker 进程,而 worker 进程则提供真正的客户服务,worker 进程的数量 ...
- Nginx系列 | [转]Nginx 上传文件:client_max_body_size 、client_body_buffer_size
原文:http://php-note.com/article/detail/488 client_max_body_size client_max_body_size 默认 1M,表示 客户端请求服务 ...
- webpack 单独打包指定JS文件
背景 最近接到一个需求,因为不确定打出的前端包所访问的后端IP,需要对项目中IP配置文件单独拿出来,方便运维部署的时候对IP做修改.因此,需要用webpack单独打包指定文件. CommonsChun ...
- 未能加载文件或程序集“Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5”或它的某一个依赖项。系统找不到指定的文件。
在创建ASP.NET MVC项目过程中发生了这个异常 未能加载文件或程序集"Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0 ...
随机推荐
- 【摘自网络】陈奕迅&&杨千嬅
揭陈奕迅杨千嬅相爱18年恋人未满的点滴片段 文/一床情书 但凡未得到,但凡是过去,总是最登对 ——题记 已经仙逝多年的香港歌坛天后梅艳芳曾经在<似是故人来>里唱道:“但凡未得到,但凡是过去 ...
- C++ 线程类的一个实现
.h #ifndef CTHREAD_H_ #define CTHREAD_H_ #include "plat.h" class CThread { public: enum { ...
- yii2.0框架中session与cookie的用法
我们在开发项目中南面使用到session给和cookie,那么在yii中有他自己的规则 如下案例: session使用 function actionS1(){ echo $t ...
- Qt窗体内控件自适应调整大小
http://stackoverflow.com/questions/3492739/auto-expanding-layout-with-qt-designer After creating you ...
- angularJS自定义指令scope代替link
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...
- 解决父类加载iframe,src参数过大导致加载失败
原文:解决父类加载iframe,src参数过大导致加载失败 <iframe src="*******.do?param=****" id="leftFrame&qu ...
- 怎么清除file控件的文件路径
还记得上次做一个文件上传,后来测试告诉我说,如果我要是不选择文件了呢?该怎么办?我说:简单啊,做一个取消按钮不就完事了吗!然后我就想一个file空间做一个取消是多么简单的事,用js处理可是想怎么样就怎 ...
- Estimating Project Costs
The Wideman Comparative Glossary of Common Project Management Terms describes estimating cost as, &q ...
- oracle 条件语句的写法
1.基本的if else DECLARE I ; BEGIN THEN DBMS_OUTPUT.PUT_LINE('TRUE'); ELSE DBMS_OUTPUT.PUT_LINE('FALSE') ...
- JS-面向对象-封装
--参考文献: --http://www.ruanyifeng.com/blog/2010/05/object-oriented_javascript_encapsulation.html --js面 ...