安装:
yum install epel-release
yum install nginx
配置:
[root@bogon ~]# vim /etc/nginx/conf.d/default.conf ... ... ... server { listen 8888; access_log /var/log/nginx/host.access.log main; location / { proxy_pass http://mirror.centos.org/; } } server { resolver 114.114.114.114 8.8.8.8; listen 8088; location / { proxy_pass http://$http_host$request_uri; } }
启动服务:
systemctl start nginx
systemctl enable nginx
或者源码安装:
http://www.nginx.org/
编译安装:
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
./configure
make
make install
配置文件:
/usr/local/nginx/conf/nginx.conf
启动:
/usr/local/nginx/sbin/nginx