nginx安装

1.下载安装包,并传到服务器  http://nginx.org/en/download.html

2.安装依赖包并添加用户

//安装gcc
yum -y install gcc
//安装依赖
yum -y install pcre-devel

3.解压安装

//添加用户
groupadd -r nginx
useradd -r -g nginx -M nginx
//安装相关的依赖库
tar zxvf nginx-1.14.0.tar.gz
./configure --user=nginx --group=nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/htttp.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock
--without-http_gzip_module
make && make install //启动 /usr/local/nginx/sbin/nginx

4.打开防火墙

firewall-cmd --zone=public --add-port=80/tcp --permanent
systemctl restart firewalld.service

5.测试

浏览器输入:http;//45.199.183.xxx  

6.主页位置 

/usr/local/nginx/html/index.html

  

 

  

 

posted @ 2018-07-12 17:11  liuyj_vv  阅读(88)  评论(0编辑  收藏  举报