zoukankan      html  css  js  c++  java
  • 全新linux中通过编译方式安装nginx

    先去官网下载linux.tar.gz包 http://nginx.org/en/download.html
     
    传到linxu中
    解压tar包
    在软件包nginx-1.15.9目录下对NGINX进行配置
     
    ./configure --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --with-http_stub_status_module --with-stream

    执行以上命令,提示这个信息:说明没有安装编译器
    checking for OS
     + Linux 3.10.0-957.el7.x86_64 x86_64
    checking for C compiler ... not found
    ./configure: error: C compiler cc is not found
    解决:yum -install gcc

    在执行以上命令提示这个信息
    ./configure: error: SSL modules require the OpenSSL library.
    You can either do not enable the modules, or install the OpenSSL library
    into the system, or build the OpenSSL library statically from the source
    with nginx by using --with-openssl=<path> option.
    解决:yum -y install openssl openssl-devel
     
    配置执行成功:
    Configuration summary
      + using system PCRE library
      + using system OpenSSL library
      + using system zlib library
      nginx path prefix: "/usr/local/nginx"
      nginx binary file: "/usr/local/nginx/nginx"
      nginx modules path: "/usr/local/nginx/modules"
      nginx configuration prefix: "/usr/local/nginx"
      nginx configuration file: "/usr/local/nginx/nginx.conf"
      nginx pid file: "/usr/local/nginx/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
    到NGINX目录下启动:./nginx
    提示以下信息:
    nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
    nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
    nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
    nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
    nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
    nginx: [emerg] still could not bind()
    原因:可能是进程已经启动,或者是端口被占用
    解决方式:先查看进程是否启动:ps -ef |grep nginx。如未启动,就是原因二。
    原因二解决方式:到安装目录下打开配置文件:vi nginx.conf。将修改为8080,再次启动即可
    启动成功后浏览器中输入ip和端口访问。
    提示“无法访问此网站”
    原因:linux中启动了防火墙,可通过:systemctl status firewalld命令查看防火墙状态
    解决方式:systemctl stop firewalld 使用该命令禁用防火墙
    再次访问ok
  • 相关阅读:
    程序猿神吐槽,说出那些苦逼的日子!
    java设计模式演示样例
    DP Leetcode
    标准差(standard deviation)和标准误差(standard error)你能解释清楚吗?
    移动开发 Native APP、Hybrid APP和Web APP介绍
    Oracle cloud control 12c 的启动与关闭
    Ubuntu文件的复制、移动和删除命令
    Android中集成第三方库的方法和问题
    腾讯QQ企业邮箱POP3/SMTP设置
    又发现支付宝和淘宝的设计漏洞
  • 原文地址:https://www.cnblogs.com/wxinyu/p/10523623.html
Copyright © 2011-2022 走看看