欧拉系统安装nginx

环境: 

操作系统版本:openEuler release 20.03 (LTS)

nginx版本:nginx-1.24.0

操作:

1.tar -zxvf nginx-1.24.0.tar.gz

2.cd  nginx-1.24.0

3. ./configure  --prefix=/usr/local/nginx(可能会出现error,情况如下)

情形一:

            ./configure: error: the HTTP rewrite module requires the PCRE library.
            You can either disable the module by using --without-http_rewrite_module
            option, or install the PCRE library into the system, or build the PCRE library
            statically from the source with nginx by using --with-pcre=<path> option.

解决方式: 

            yum install -y pcre pcre-devel

情形二:

            ./configure: error: the HTTP gzip module requires the zlib library.
            You can either disable the module by using --without-http_gzip_module
            option, or install the zlib library into the system, or build the zlib library
             statically from the source with nginx by using --with-zlib=<path> option.

解决方式:

             yum -y install zlib zlib-devel

情形三:

             缺少gcc

解决方式:

             yum install -y gcc

没有errors的回显如下:

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"

4.make and make install

到此基础安装操做基本结束。

启动方式:

进入安装好的目录 cd /usr/local/nginx

                              ls的输出如下:

                             conf  html  logs  sbin

命令:(基于该路径下 /usr/local/nginx/sbin)

                              ./nginx                (启动)

                              ./nginx -s stop    (快速停止)            

                               ./nginx -s quit     (退出前完成已经接受的连接请求)

                               ./nginx -s reload (重新加载)

查看启动状态:

[root@localhost sbin]# ps -ef | grep nginx
root       17449       1  0 03:00 ?        00:00:00 nginx: master process ./nginx
nobody     17451   17449  0 03:00 ?        00:00:00 nginx: worker process
root       17476   11400  0 03:00 pts/0    00:00:00 grep --color=auto nginx
[root@localhost sbin]# 

此时curl ip 返回结果为403

解决方式:vi nginx.conf  将user设为root

user  root;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
 

页面验证结果:

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

  • 10
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值