12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
ADADADADAD
建站问答 时间:2024-12-24 19:00:38
作者:文/会员上传
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
LINUX安装nginx详细步骤1.安装依赖包//一键安装上面四个依赖yum y install gcc zlib zlibdevel pcredevel openssl openssldevel2.下载并解压安装包//创建一个文件夹cd /usr
以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。
LINUX安装nginx详细步骤
1.安装依赖包
//一键安装上面四个依赖
yum y install gcc zlib zlibdevel pcredevel openssl openssldevel
2.下载并解压安装包
//创建一个文件夹
cd /usr/local
mkdir nginx
cd nginx
//下载tar包
wget nginx.org/download/nginx1.13.7.tar.gz
tar xvf nginx1.13.7.tar.gz
3.安装nginx
//进入nginx目录
cd /usr/local/nginx
//进入目录
cd nginx1.13.7
//执行命令 考虑到后续安装ssl证书 添加两个模块
./configure withhttp_stub_status_module withhttp_ssl_module
//执行make命令
make
//执行make install命令
make install
4.启动nginx服务
/usr/local/nginx/sbin/nginx c /usr/local/nginx/conf/nginxonf
配置nginxonf
打开配置文件
vi /usr/local/nginx/conf/nginxonf
将端口号改成9(随便挑个端口),因为可能apeache占用80端口,apeache端口尽量不要修改,我们选择修改nginx端口。
将localhost修改为你服务器的公网ip地址。
5.重启nginx
/usr/local/nginx/sbin/nginx s reload
查看nginx进程是否启动:
ps ef | grep nginx
6.若想使用外部主机访问nginx,需要关闭服务器防火墙或开放nginx服务端口,端口为上一步nginxonf的配置端口:
centOS6及以前版本使用命令: systemctl stop iptables.service
centOS7关闭防火墙命令: systemctl stop firewalld.service
关闭防火墙会导致服务器有一定风险,所以建议是单独开放服务端口 :
开放80端口:
firewallcmd zone=public addport=80/tcp permanent
查询端口号80 是否开启:
firewallcmd queryport=80/tcp
重启防火墙:
firewallcmd reload
随后访问该ip:端口 即可看到nginx界面。
7.访问服务器ip查看(备注,由于我监听的仍是80端口,所以ip后面的端口号被省略)
安装完成一般常用命令
进入安装目录中,
命令: cd /usr/local/nginx/sbin
启动,关闭,重启,命令:
./nginx 启动
./nginx s stop 关闭
./nginx s reload 重启
报错
进入objs目录下修改Makefile文件
CFLAGS = pipe O W Wall Wpointerarith Wnounusedparameter ** Werror** g
将 ** Werror** 去掉
错误
安装nginx源
curl o /etc/yum.repos.d/epel.repo mirrors.aliyun/repo/epel7.repo
先安装
yum y install epelrelease
#应该是缺少modules模块
yum y install nginxallmodules.noarch
然后在用nginx t就好了
[root@k8snode2 ~]# nginx t
nginx: the configuration file /etc/nginx/nginxonf syntax is ok
nginx: configuration file /etc/nginx/nginxonf test is successful
添加使用–withstream=dynamic 配置
./configure prefix=/usr/local/nginx/ withstream=dynamic
然后make make install
make
make install
11-20
11-19
11-20
11-20
11-20
11-19
11-20
11-20
11-19
11-20
11-19
11-19
11-19
11-19
11-19
11-19