centos7 离线配置安装nginx
来源:互联网 发布:多伦多大学知乎 编辑:程序博客网 时间:2024/05/22 01:37
下载nginx包
tar -zxvf nginx-1.13.7.tar.gzcd nginx-1.13.7
安装
./configuremake clean ####清除./configure时产生的临时文件
可能会报错误
### the HTTP rewrite module requires the PCRE library. ###显示需要pcre
rpm -ivh pcre pcre-devle zlib zlib-devle
./configure
执行完成会看到
###
Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ using system zlib library
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx modules path: "/usr/local/nginx/modules"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
####
make
make install
测试是否安装成功
cd /usr/local/nginx./sbin/nginx -t
显示结果
[root@192 nginx]# ./sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
cd /usr/local/nginx/sbin
./nginx ###启动nginx
通过端口查看nginx是否开启
netstat -ntlp | grep 80
###
[root@192 sbin]# netstat -ntlp | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 7485/nginx: master
###
#重启防火墙
systemctl restart firewalld
firewall-cmd --query-port=80/tcp
firewall-cmd --add-port=80/tcp --permanent
配置nginx开机自启动
vim /etc/rc.d/rc.local
/usr/local/nginx/sbin/nginx
将nginx加入systemctl
vi /usr/lib/systemd/system/nginx.service
[Unit]
Description=The nginx HTTP and reverse proxy server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
###通过 find / -name 'nginx.pid'找到pid的位置
PIDFile=/usr/local/nginx/logs/nginx.pid
# Nginx will fail to start if /run/nginx.pid already exists but has the wrong
# SELinux context. This might happen when running `nginx -t` from the cmdline.
# https://bugzilla.redhat.com/show_bug.cgi?id=1268621
ExecStartPre=/usr/bin/rm -f /usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
KillSignal=SIGQUIT
TimeoutStopSec=5
KillMode=process
PrivateTmp=true
[Install]
WantedBy=multi-user.target
:wq
保存退出
开启开机启动
systemctl enable nginx.service
systemctl restart nginx
pkill -9 nginx
systemctl start nginx.service
可以查看相关链接:http://blog.csdn.net/waneto2008/article/details/52729487
阅读全文
0 0
- centos7 离线配置安装nginx
- centos7安装配置Nginx
- centos7下nginx安装配置
- centos7系统安装配置nginx
- CentOS7安装nginx及配置
- CentOS7之Nginx安装配置
- centos7 下Nginx安装配置
- Centos7安装配置nginx服务器
- centos7离线安装Docker
- centos7离线安装docker
- centos7离线安装iptables
- centos7 离线安装mysql
- CentOS7中安装配置PHP7+Nginx
- centos7 nginx的简易安装配置
- 在Centos7下源代码安装配置Nginx
- centos7安装并配置nginx+php
- centos7.3下nginx安装及配置
- centos7+nginx+php安装与配置
- JAVA 压缩单个文件
- 中国网建SMS短信接口调用(java发送短信)
- Java:String、Date、Calendar之间的转换
- linux jvm 时区
- 1
- centos7 离线配置安装nginx
- Android 找控件的五种方式,解放你的双手!
- 百度定位的简单应用
- 重大改变!Python 或将取代 VBA 成为 Excel 官方脚本语言
- mysql 在查询结果中进行二次查询
- Uber AI实验室总结「神经进化」研究:如何利用遗传算法优化网络?
- 这三个普通程序员,几个月就成功转型AI,他们的经验是...
- 1
- 学习日记