centos7源码安装nginx

发布时间:2020-06-06 18:51:12 作者:lcpljc
来源:网络 阅读:405

1、服务器版本:CentOS Linux release 7.4.1708 (Core)

2、nginx版本:nginx-1.14.2.tar.gz 

3、部署步骤

 /usr/sbin/groupadd -f www 
 /usr/sbin/useradd -g www www
yum install -y pcre-devel openssl-devel
yum -y install gcc gcc-c++ autoconf automake make
cd /data/application
tar xf /data/pkg/nginx-1.14.2.tar.gz
cd nginx-1.14.2
./configure --prefix=/data/application/nginx  --conf-path=/data/application/nginx/conf/nginx.conf --error-log-path=/data/application/nginx/log/error.log --http-log-path=/data/application/nginx/log/access.log  --pid-path=/data/application/nginx/conf/nginx.pid --http-proxy-temp-path=/data/application/nginx/cache/proxy_temp --http-fastcgi-temp-path=/data/application/nginx/cache/fastcgi_temp  --user=www --group=www  --with-http_realip_module   --with-http_gunzip_module --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module  --with-http_sub_module --with-http_realip_module --with-http_sub_module

make && make install

firewall-cmd --add-port=80/tcp --permanent

firewall-cmd --reload

4、增加自启动:

vim /lib/systemd/system/nginx.service

[Unit]
Description=nginx
After=network.target
  
[Service]
Type=forking
ExecStart=/data/application/nginx/sbin/nginx
ExecReload=/data/application/nginx/sbin/nginx -s reload
ExecStop=/data/application/nginx/sbin/nginx -s quit
PrivateTmp=true
  
[Install]
WantedBy=multi-user.target
------------------------------------------


systemctl enable nginx
systemctl start nginx


推荐阅读:
  1. CentOS7下源码安装MySQL 8.x
  2. CentOS7下安装Nginx

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

centos7 源码 安装

上一篇:大有可为,SuperTextView(v3.2.1)

下一篇:SVN密码密文生成

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》