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

相关推荐
网硕互联的小客服3 小时前
Linux服务器磁盘应该如何合理分区?
linux·运维·服务器
lisanmengmeng4 小时前
nacos nrpe 监控机及被监控机部署
服务器·nacos·nagios·nrpe
Lsetea4 小时前
OpenSSL verify报error 20:CAfile、fullchain与本地信任链分层排查
nginx·https·ssl证书·openssl·证书链
贵沫末4 小时前
Ubuntu——常用软件安装
linux·运维·ubuntu
Doraemomo5 小时前
Linux内核驱动开发——中断与定时器
linux·运维·驱动开发
2301_808414385 小时前
Linux中动静态库的理解
linux·运维·服务器
M78佐菲6 小时前
ARM学习笔记(11)
linux·arm开发·笔记·嵌入式硬件·学习
M78佐菲6 小时前
ARM学习笔记(10)
linux·arm开发·笔记·嵌入式硬件·学习
半仙白桑6 小时前
内核篇第十五讲:system-V共享内存
linux·共享内存·shmget·shmat·shmdt·shmctl
一条破秋裤7 小时前
Linux 线程创建:pthread_create 与基本回收
java·linux·运维