安装nginx

来源:互联网 发布:java返回值是什么意思 编辑:程序博客网 时间:2024/06/10 04:09

把 Nginx 安装到 /var/www 目录下的详细步骤:

1、cd /var/www
tar -zxvf nginx-1.10.2.tar.gz
cd nginx-1.10.2

2、配置nginx安装参数

复制代码
./configure \
–prefix=/var/www \
–with-openssl= \
–with-pcre=/var/www/pcre-8.39 \
–with-zlib=/var/www/pcre-8.39/zlib-1.2.11 \
–with-openssl=/usr/local/src/openssl-1.1.0b \
–without-ipv6 \
–with-http_secure_link_module \
–with-ngx_http_limit_zone_module \
–http-log-path=/var/log \
–http-proxy-temp-path=/var/www/log \
编译安装

make && make install
3、启动

确保系统的 80 端口没被其他程序占用,运行/var/www /nginx 命令来启动 Nginx

4、netstat -ano|grep 80
打开浏览器访问此机器的 IP,如果浏览器出现 Welcome to nginx! 则表示 Nginx 已经安装并运行成功