nginx

来源:互联网 发布:windows清除arp 编辑:程序博客网 时间:2024/05/20 03:40
  1. 准备环境
    (1)关闭防火墙:iptables -F
    或者 systemctl stop firewall 立即关闭防火墙
    systemctl disable firewall 开机关闭防火墙
    关闭selinux: setenforce 0
    (2)配置IP。
  2. 安装软件包
    (1)二进制安装:yum install epel-release -y
    yum install nginx -y
    (2)源码安装:yum install pcre-* -y
    tar xvf nginx.tar.gz
    cd nginx/
    ./configure –prefix=/usr/local/nginx/
    make && make install
  3. 修改配置文件:
    (1)二进制安装:/etc/nginx/nginx.conf
    (2)源码安装:/usr/local/nginx/conf/nginx.conf
  4. 启动
    (1)二进制安装:systemctl start nginx
    (2)源码安装:/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
  5. 测试

补充:状态码:200 访问成功
3开头 重定向
4开头 客户端的问题
5开头 服务端的问题
netstat -an |grep 8080 查看8080端口状态

原创粉丝点击