linux 离线安装nginx

tar -zxvf /home/nginx-1.26.3.tar.gz -C /usr/local
cd /usr/local/nginx-1.26.3/
./configure
make && make install

vim /etc/profile

export PATH=$PATH:/usr/local/nginx/sbin
source /etc/profile
vim /etc/systemd/system/nginx.service

复制代码
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network.target

[Service]
Type=forking
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop

[Install]
WantedBy=multi-user.target

systemctl daemon-reload
firewall-cmd --add-port=80/tcp --permanent
firewall-cmd --reload
vim /usr/local/nginx/conf/nginx.conf
include /etc/nginx/conf.d/*.conf;
systemctl enable nginx.service
systemctl start nginx.service
systemctl status nginx.service
查看开机自启动的服务列表

systemctl list-units --type=service
systemctl stop nginx.service

相关推荐
cqsztech28 分钟前
oracle linux 10 +pg18 源码安装要点
linux·数据库·oracle
奥尔特星云大使32 分钟前
ALTER 与 UPDATE、DROP 与 DELETE区别
linux·运维·数据库·mysql
野犬寒鸦35 分钟前
多级缓存架构:性能与数据一致性的平衡处理(原理及优势详解+项目实战)
java·服务器·redis·后端·缓存
duangww1 小时前
部署sapui5应用到linux
linux·sap fiori
siriuuus2 小时前
Linux ssh/scp/sftp命令使用及免密登录配置
linux·ssh·sftp·scp
海琴烟Sunshine3 小时前
Leetcode 14. 最长公共前缀
java·服务器·leetcode
teacher伟大光荣且正确3 小时前
Linux 下编译openssl
linux·运维·服务器
dlz08364 小时前
--group-start/--group-end 能不能解决 OpenSSL 1.0 vs 1.1 的优先级问题?
linux·运维·服务器·软件需求
小池先生5 小时前
activemq延迟消息变成实时收到了?
linux·数据库·activemq
tryCbest5 小时前
Linux系统下安装使用Redis
linux·运维·redis