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

相关推荐
恒53920 分钟前
Linux文件系统I
linux·运维·服务器
阿成学长_Cain32 分钟前
Linux ipcs 命令超全详解:查看共享内存 / 消息队列 / 信号量,IPC 运维必备
linux·运维·服务器·网络·数据库
黯然神伤88834 分钟前
AlmaLinux设置软件下载源
linux·alma
青瓦梦滋1 小时前
协议定制/序列化-反序列化(Linux视角)
linux·服务器·网络·c++
阿成学长_Cain4 小时前
Linux dirs命令详解|Bash目录堆栈管理快速切换目录实战教程
linux·运维·前端·数据库
ICECREAM5 小时前
Linux 进程间通讯(IPC)——总结
linux
想你依然心痛6 小时前
嵌入式Linux安全加固:SELinux、Capabilities与Seccomp——强制访问控制与沙箱
linux·运维·安全
MDM.Plus7 小时前
苹果MDM技术演进:从远程控制到设备信任体系的构建
运维·服务器·安全·ios·mdm·手机店
REDcker8 小时前
macOS 挂载 Linux 远程目录详解
linux·运维·macos