安装nginx,自定义服务器名称

94
0

#移除默认openssl

yum remove openssl

 

# 编译安装Openssl

./config  --prefix=/usr/local/openssl
make
make install 

 

# 编译安装Nginx

./configure --prefix=/usr/local/nginx --with-openssl=../openssl-1.1.1i --with-pcre --with-zlib=../zlib-1.2.11 --with-stream --with-stream_ssl_module --with-http_ssl_module --with-http_v2_module --with-threads --with-openssl-opt='enable-tls1_3'
make
make install

 

#通过systemctl 管理 nginx

/usr/lib/systemd/system/nginx.service
[Unit]
Description=nginx
After=network.target
  
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true
  
[Install]
WantedBy=multi-user.target

 

#启动管理nginx

#启动
systemctl start nginx
#重启
systemctl restart nginx
#停止
systemctl stop nginx
#状态
systemctl status nginx

#其他的自己百度

 

全部评论