Centos7 源码安装Nginx

第一步:依赖环境安装:
	yum install pcre pcre-devel openssl openssl-devel zlib zlib-devel -y
	yum install gcc gcc-c++ make libtool -y
第二步:下载nginx 版本,官网下载地址:http://nginx.org/download/
	解压下载nginx版本:
	tar -xvf nginx-1.13.10.tar.gz
	下载rtmp,并解压:
	wget https://github.com/arut/nginx-rtmp-module/archive/v1.1.11.tar.gz
	tar -xvf v1.1.11.tar.gz
	
第三步:编译NGINX,添加rtmp模块(视频直播,可以不添加--add-module=/ftp/pub/nginx-rtmp-module-1.1.11/)
	[root@localhost pub]# cd  nginx-1.13.10 
	[root@localhost nginx-1.13.10]# ./configure --add-module=/ftp/pub/nginx-rtmp-module-1.1.11/
	Configuration summary
	+ using system PCRE library
	+ using system OpenSSL library
	+ using system zlib library

	nginx path prefix: "/usr/local/nginx"
	nginx binary file: "/usr/local/nginx/sbin/nginx"
	nginx modules path: "/usr/local/nginx/modules"
	nginx configuration prefix: "/usr/local/nginx/conf"
	nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
	nginx pid file: "/usr/local/nginx/logs/nginx.pid"
	nginx error log file: "/usr/local/nginx/logs/error.log"
	nginx http access log file: "/usr/local/nginx/logs/access.log"
	nginx http client request body temporary files: "client_body_temp"
	nginx http proxy temporary files: "proxy_temp"
	nginx http fastcgi temporary files: "fastcgi_temp"
	nginx http uwsgi temporary files: "uwsgi_temp"
	nginx http scgi temporary files: "scgi_temp"

	[root@localhost nginx-1.13.10]# make && make install

第四步:开放指定端口和防火墙重启
	[root@localhost nginx]# firewall-cmd --add-port=80/tcp --permanent
	success
	[root@localhost nginx]# firewall-cmd --add-port=8000/tcp --permanent
	success
	[root@localhost nginx]# firewall-cmd --add-port=8080/tcp --permanent
	success
	[root@localhost nginx]# firewall-cmd --reload

第五步:nginx 启动、设置开机自启动及其相关指令:
	进入NGINX安装目录,执行./nginx 启动nginx
	[root@localhost html]# cd /usr/local/nginx/sbin
	[root@localhost html]# ./nginx
	设置nginx 开机自启动(编辑/etc/rc.d/rc.local文件,添加如下代码):
	[root@localhost sbin]# vi /etc/rc.d/rc.local
	# nginx start
	/usr/local/nginx/sbin/nginx
	[root@localhost sbin]# chmod +x /etc/rc.d/rc.local #添加相关权限
	停止nginx:
	[root@localhost html]# cd /usr/local/nginx/sbin
	[root@localhost html]# ./nginx -s stop
	重新启动nginx
	[root@localhost html]# cd /usr/local/nginx/sbin
	[root@localhost html]# ./nginx -s reload

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值