标签:figure system 注意 server href 5.5 gcc-c++ 目录 sha
Nginx是非常优秀的反向代理服务器,现在把安装记录记一下,好记性不如烂笔头^-^2、PCRE pcre-devel 安装
yum install -y pcre pcre-devel
3、zlib 安装
yum install -y zlib zlib-devel
4、OpenSSL 安装
yum install -y openssl openssl-devel
5、下载Nginx (目前最新稳定版本1.15.5)
wget -c https://nginx.org/download/nginx-1.15.0.tar.gz
解压
tar -zxvf nginx-1.15.5.tar.gz
cd nginx-1.15.5
自定义配置
./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/scgi
注意:选择了/var/temp/nginx为临时目录,如果没有该路径需要创建
编译安装
make
make install
启动、停止nginx
cd /usr/local/nginx/sbin/
./nginx
./nginx -s stop
./nginx -s quit
./nginx -s reload
注册服务
cd /usr/lib/systemd/system/
vi nginx.service
[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/webserver/nginx/sbin/nginx
ExecReload=/usr/local/webserver/nginx/sbin/nginx -s reload
ExecStop=/usr/local/webserver/nginx/sbin/nginx -s stop
PrivateTmp=true
[Install]
WantedBy=multi-user.target
保存
systemctl daemon-reload重新加载
开机自启动
systemctl enable nginx.service
查看状态
systemctl status nginx.service
显示running就OK啦
标签:figure system 注意 server href 5.5 gcc-c++ 目录 sha
原文地址:http://blog.51cto.com/11358291/2308341