流苏小筑

CentOS安装Nginx

CentOS安装Nginx

1.安装Nginx前的准备

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

2.下载Nginx和其组件

cd /usr/local/src
wget http://www.openssl.org/source/openssl-fips-2.0.16.tar.gz
tar -zxvf openssl-fips-2.0.16.tar.gz
cd  openssl-fips-2.0.16
./configure && make && make install
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.42.tar.gz
tar -zxvf pcre-8.42.tar.gz
cd pcre-8.42
./configure && make && make install
yum -y install openssl openssl-devel
yum -y install pcre pcre-devel
yum -y install zlib zlib-devel
wget http://nginx.org/download/nginx-1.15.0.tar.gz
tar -zxvf nginx-1.15.0.tar.gz
cd nginx-1.15.0
./configure && make && make install

3.启动nginx

cd /usr/local/nginx/sbin/(进入nginx安装目录)
./nginx

4.修改nginx配置文件

vi /usr/local/nginx/conf/nginx.conf
server {
        listen       80;
        server_name  coder7911.club;
        location / {
            proxy_pass   http://127.0.0.1:8080;
        }
    }

5.nginx常用相关命令

./nginx
./nginx -t
./nginx -s relaod
ps -ef|grep nginx
kill -9 进程号
tail -f /usr/local/nginx/logs/access.log

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »