1.解压
tar -xf nginx-1.10.1.tar.gz
2.配置
cd nginx-1.10.1
./configure --prefix=/data/my/nginx(注意这个目录是一个新目录,不是解压的源文件目录)
此时可能会提示
./configure: error: the HTTP rewrite module requires the PCRE library.
安装pcre-devel与openssl-devel解决问题
yum -y install pcre-devel openssl openssl-devel
./configure: error: C compiler cc is not found
yum -y install gcc gcc-c++ autoconf automake make
./configure: error: the HTTP rewrite module requires the PCRE library.
yum -y install pcre-devel
./configure: error: the HTTP gzip module requires the zlib library.
yum install -y zlib-devel
然后继续
./configure --prefix=/data/my/nginx --with-http_ssl_module#如果不用https可以省掉后面这个参数
make
make install
安装完成后
cd /data/my/nginx/sbin
运行ng
./nginx
查看ng进程
ps -ef|grep nginx
查看80端口是否被ng占用lsof -i tcp:80
启动,停止,重载ng
./nginx
./nginx -s stop
./nginx -s quit
./nginx -s reload
重启ng,先停止再启动(推荐)
./nginx -s quit
./nginx
在浏览器上试着访问http://ip:80,如不能访问,可能是防火墙的问题
firewall-cmd --state#查看防火墙状态
systemctl start firewalld.service#启动firewall
systemctl stop firewalld.service#停止firewall
systemctl disable firewalld.service#禁止firewall开机启动
如果开启了防火墙,
要执行以下命令:
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --zone=trusted --add-port=80/tcp
开机启动
vi /lib/systemd/
system
/nginx.service
复制:
[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=
true
[Install]
WantedBy=multi-user.target
保存完毕后
systemctl enable nginx.service
相关推荐
centos7安装nginx1.16.1安装文档,有需要的朋友们下载。 centos7安装nginx1.16.1安装文档,有需要的朋友们下载。
CentOS 7安装nginx 全过程.pdf
CentOS7安装nginx&&php7整合包
CentOS7安装Nginx1.11
centos7下在有网络和没网络的情况安装nginx;
CentOS7 Nginx安装
二、yum安装Nginx1.添加nginx的yum源Centos7自带的yum repo仓库没有nginx安装包,所以要添加nginx的yum repo源文件,
centos7离线安装nginx所需的全部软件,解压后将所有rpm包依次安装即可
centos7.6离线安装nginx
linux系统安装nginx
在完全无互联网连接的情况下,离线安装nginx。 nginx版本号:nginx-1.20.1-2.el7.x86_64 食用方法: 1.解压 2.进入解压目录 3.rpm安装全部 4.安装完成
主要介绍了Centos7安装nginx后提示“Welcome to nginx on Fedora!”,conf.d目录下无default.conf文件 ,本文给出了问题原因解析及解决方法,需要的朋友可以参考下
主要介绍了CentOS7安装Nginx并配置自动启动的方法步骤,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
Ps:如果按照包里的配置文件路径访问,需授权后才能访问,类似Windows的其他用户文件夹。 授权命令:chmod 777 *
Linux系统下安装nginx-1.14.1所需的所有包 以及rpm依赖包,安装文档 https://blog.csdn.net/weixin_41851100/article/details/89565198
centOS8安装nginx及nginx配置
这里记录一下自己在centos7操作系统下安装nginx的过程,以便之后学习时查阅。笔者这里的Linux服务器使用的是腾讯云服务器,本人是一名Java程序员也是Linux的初学者有什么不对的地方请多指教,以后还会有更多的关于...
CentOS7+,压缩保证包含 gcc\gcc-c++所有安装rpm包;openssl包;zlib包;pcre的包以及nginx安装包,支持Linux下离线安装nginx 如下: nginx-1.15.12.tar.gz openssl-1.0.2r.tar.gz pcre-8.42.tar.gz zlib-1.2.11.tar...
目录CentOS7安装nginx1.16.1一、去官网下载对应的nginx包,推荐使用稳定版本二、上传nginx到linux系统三、安装依赖环境3.1、安装gcc环境3.2、安装PCRE库,用于解析正则表达式3.3、zlib压缩包和解压包依赖3.4、SSL...