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)

 

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐