0
点赞
收藏
分享

微信扫一扫

bc-liunx欧拉编译安装nginx

微言记 2023-06-28 阅读 28

1、下载nginx包上次至目标服务器

2、解压包

3、安装依赖包

yum install -y pcre pcre-devel pcre pcre-devel openssl openssl-devel  zlib zlib-devel gd gd-devel

4、编译安装nginx,这里记住nginx不要放在和编译路径一个文件夹,不然会报错,一下是编译命令与建议参数

./configure --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --with-http_stub_status_module --with-http_ssl_module

5、创建启动文件,创建后可以用系统命令控制nginx启停

[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload= /usr/local/nginx/sbin/nginx -s reload
ExecStop= /usr/local/nginx/sbin/nginx -s stop
PrivateTmp=true

[Install]
WantedBy=multi-user.target

5、安装

make&&make install 

6、更改文件夹权限

7、启动

./usr/local/nginx/sbin/nginx -t 检测配置文件

./usr/local/nginx/sbin/nginx -s start/reload/stop


举报

相关推荐

0 条评论