nginx编译安装

nginx编译安装
===========================================
Nginx官网:http://nginx.org/
Nginx官网下载地址(选择 Stable version 稳定版):http://nginx.org/en/download.html
官网安装介绍:http://nginx.org/en/linux_packages.html


一:安装

1.1:环境准备
    ~]# yum -y install gcc gcc-c++  pcre-devel  openssl-devel

2.2:编译安装
    ~]# tar -axf nginx-1.10.0.tar.gz

    ~]# cd nginx-1.10.0/

    ~]# ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-threads --with-stream --with-stream_ssl_module --with-http_slice_module --with-file-aio --with-http_v2_module

    ~}# make && make install



    
1.3:加入环境变量
        ~]# echo 'export PATH=$PATH:/usr/local/nginx/sbin/' >  /etc/profile.d/nginx.sh
        
        ~]# source /etc/profile.d/nginx.sh


1.4:启动与重启停止
        启动:nginx
        重载:nginx -s reload
        快速停止:nginx -s stop
        有序退出:nginx -s quit

1.5:加入系统服务与开机启动



CentOS 7:
    ~]# vi /usr/lib/systemd/system/nginx.service
--------------------------file start---------------------------------
[Unit]  
Description=nginx  
After=network.target remote-fs.target nss-lookup.target

[Service]  
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx  
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s  stop
PrivateTmp=true  

[Install]  
WantedBy=multi-user.target
--------------------------file end---------------------------------

    开机启动
        ~]# systemctl enable nginx.service
    开机不启动
        ~]# systemctl disable nginx.service
    其他操作:
        ~]# systemcl ( status | start | stop | reload | restart ) nginx.service


    其他操作:
        ~]# service nginx (start|stop|reload|configtest|status|force-reload|upgrade|restart|reopen_logs)

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

水月情缘雪飞飞

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值