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

相关推荐
樂5027 分钟前
关于 Web 服务器的五个案例
linux·服务器·经验分享
用户2175161143824 分钟前
【linux】重定向与缓冲区
linux
一键三联啊27 分钟前
【FastJSON】的parse与parseObject
linux·前端·python
离凌寒44 分钟前
一、linux系统启动过程操作记录
linux
qq_543248521 小时前
正则表达式三剑客之——grep和sed
linux·运维·正则表达式
码农新猿类1 小时前
信号量函数
linux·c++·visual studio
H1346948901 小时前
服务器异地备份,服务器异地备份有哪些方法?
运维·服务器
ImAlex1 小时前
运维大师教你使用流量监控神器nethogs分析Linux进程网络流量
linux·运维
杰克崔1 小时前
rt-linux下的cgroup cpu的死锁bug
linux·车载系统
ImAlex1 小时前
运维大神教你如何用iftop和ss命令结合排查带宽占用高的进程
linux·运维