nginx linux服务器安装

1.查看是否有OpenSSL

ssh -V

下载nginx地址 http://nginx.org/en/download.html

2.解压到usr/local(到这个路径下使用)

cd /usr/local/nginx

3.执行命令

./configure

#提示权限不够,执行

chmod +x configure

#报错

#./configure: error: C compiler cc is not found 执行安装gcc 编译器

yum -y install gcc gcc-c++ autoconf automake make

#报错

#nginx error: the HTTP rewrite module requires the PCRE library.

#安装下

yum -y install pcre-devel

#报错 需要安装“zlib-devel”即可 ./configure: error: the HTTP gzip module requires the zlib library.

yum install -y zlib-devel

4.//执行make命令

make

报错 缺少依赖
在这里插入图片描述
yum install pcre-devel zlib zlib-devel openssl openssl-devel

​如果还是报错,执行下

./configure

//执行make install命令

make install

报错
在这里插入图片描述
执行

./configure --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/nginx.conf

解决

5.替换 /usr/local/nginx/conf 里的配置文件

  1. 开机自启

vim /etc/rc.local

在文件末尾添加

/usr/local/nginx/sbin/nginx

nginx配置完成

启动nginx

端口占用

ps -ef|grep java 查看情况

启动,关闭,重启,命令:

到sbin目录下执行

./nginx 启动

./nginx -s stop 关闭

./nginx -s reload 重启

如果出现报错:nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed

则运行: /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值