您的位置:首页 > 运维架构 > Nginx

centos下安装nginx

2020-06-02 05:45 393 查看
1.下载
[root@ticent ~]# wget http://nginx.org/download/nginx-1.12.0.tar.gz
--2017-06-04 13:57:58--  http://nginx.org/download/nginx-1.12.0.tar.gz
正在解析主机 nginx.org (nginx.org)... 206.251.255.63, 95.211.80.227, 2001:1af8:4060:a004:21::e3, ...
正在连接 nginx.org (nginx.org)|206.251.255.63|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Found
位置:http://219.238.4.195/files/408700000566084C/nginx.org/download/nginx-1.12.0.tar.gz [跟随至新的 URL]
--2017-06-04 13:58:01--  http://219.238.4.195/files/408700000566084C/nginx.org/download/nginx-1.12.0.tar.gz
正在连接 219.238.4.195:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:980831 (958K) [application/octet-stream]
正在保存至: “nginx-1.12.0.tar.gz”

100%[==================================================================>] 980,831     1.36MB/s 用时 0.7s   

2017-06-04 13:58:02 (1.36 MB/s) - 已保存 “nginx-1.12.0.tar.gz” [980831/980831])
2.解压
[root@ticent ~]# tar -zxvf nginx-1.12.0.tar.gz

3.安装依赖包
yum install gcc-c++
yum install pcre pcre-devel
yum install zlib zlib-devel
yum install openssl openssl--devel
4.安装
[root@ticent nginx-1.12.0]# ./configure

[root@ticent nginx-1.12.0]# make

[root@ticent nginx-1.12.0]# make install
5.查看安装目录
[root@ticent nginx-1.12.0]# whereis nginx
nginx: /usr/local/nginx
6.启动
[root@ticent sbin]# ./nginx
7.修改防火墙,开放80端口
[root@ticent ~]# vi /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8081:8100 -j ACCEPT

8.从其他机器访问,验证连通性
http://192.168.128.128/

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31464246/viewspace-2140265/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/31464246/viewspace-2140265/

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: