搜索
您的当前位置:首页正文

nginx源码安装

来源:知库网

1,安装依赖包

[root@web50 ~]# yum -y install zlib-devel openssl-devel pcre-devel gcc make

2,nginx下载

[root@web50 iso]# ls

nginx-1.12.2.tar.gz

3,解压安装

[root@web50 iso]# tar -xvf nginx-1.12.2.tar.gz

[root@web50 iso]# ls

nginx-1.12.2  nginx-1.12.2.tar.gz

[root@web50 nginx-1.12.2]# ./configure --help

--prefix=PATH

--user=USER

--group=GROUP

--without-mail_pop3_module disable ngx_mail_pop3_module

  --without-mail_imap_module        disable ngx_mail_imap_module

  --without-mail_smtp_module        disable ngx_mail_smtp_module

..........

[root@web50 nginx-1.12.2]# useradd -s /sbin/nologin nginx

[root@web50 nginx-1.12.2]# make && make install

[root@web50 ~]# ls /usr/local/nginx/

conf  html  logs  sbin

[root@web50 ~]# ln -s /usr/local/nginx/sbin/nginx /sbin/       

[root@web50 ~]# nginx

[root@web50 ~]# ss -tunlp | grep :80

tcp    LISTEN    0      128      *:80                    *:*                  users:(("nginx",pid=3816,fd=6),("nginx",pid=3815,fd=6))

提示:

[root@web50 ~]# nginx

[root@web50 ~]# nginx -s reload

[root@web50 ~]# nginx -s stop

4,验证

注意关闭防火墙:

[root@web50 ~]# iptables -F

[root@web50 ~]# systemctl stop firewalld

<!DOCTYPE html>

<html>

<head>

<title>Welcome to nginx!</title>

........

</html>

或者打开浏览器输入


看官福利:


结束语:

更多精彩内容持续更新中,关注我,有你更精彩。

Top