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

相关推荐
向qian看_-_1 天前
Linux 使用pip报错(error: externally-managed-environment )解决方案
linux·python·pip
yaoxtao1 天前
java.nio.file.InvalidPathException异常
java·linux·ubuntu
fuyongliang1231 天前
linux Nginx服务配置介绍,和配置流程
运维·服务器·网络
2501_920047031 天前
git在Linux中的使用
linux·git·elasticsearch
程序设计实验室1 天前
在鸡哥14x上安装Linux:Fedora 42 上手体验
linux
UNbuff_01 天前
Linux bzip2 命令使用说明
linux·运维·服务器
小马哥编程1 天前
DNS解析中的服务器协作机制
服务器·git·github
IOT-Power1 天前
Ubuntu下把 SD 卡格式化为 FAT32
linux·运维·ubuntu
嫩萝卜头儿1 天前
虚拟地址空间:从概念到内存管理的底层逻辑
linux·服务器·网络
LJC_Superman1 天前
Web与Nginx网站服务
运维·服务器·前端·网络·数据库·nginx·vim