install Nginx iptables

  1. install the dependent package

    yum install -y pcre pcre-devel

    yum install -y zlib zlib-devel

  2. get nginx package

    wget http://nginx.org/download/nginx.1.8.1.tar.gz

  3. create user id for nginx

    useradd -M -s /sbin/nologin nginx

  4. install nginx

    tar xvzf nginx.1.8.1.tar.gz

    cd nginx.1.8.1

    ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_module

    make

    make install

    ln -s /usr/local/nginx/sbin/* /usr/local/sbin

  5. test nginx‘s configure file

    将nginx.conf的user nobody 改为user nginx

    nginx -t

  6. start nginx server

    nginx

  7. configure firewall

    iptables -F

    iptables -p INPUT DROP

    iptables -p FORWARD DROP

    iptables -p OUTPUT ACCEPT

    iptables -A INPUT -p tcp --dport 80 -j ACCEPT

    iptables -A OUTPUT -p tcp --sport 80 -j ACCEPT (注:这个规则,如果你把OUTPUT 设置成DROP的就要写上这一部,好多人都是在这里被坑了。)

    若要永久生效,将changes写入/etc/sysconfig/iptables文件:

    /etc/rc.d/init.d/iptables save

    /etc/rc.d/init.d/iptables restart

  8. access to nginx from web client
时间: 2024-10-12 22:35:47

install Nginx iptables的相关文章

Install Nginx/PHP-FPM on CentOS/RHEL

Install Nginx, PHP 5.5.15 and PHP-FPM on Fedora 20/19/18/17, CentOS 7/6.5/5.10, Red Hat (RHEL) 7/6.5/5.10 1. Change to root user. su 2. Install needed repositories CentOS 7/6.5/5.10 and Red Hat (RHEL) 7/6.5/5.10 Remi repository  ## Remi Dependency on

yum install nginx

先安装nginx的yum源 http://nginx.org/en/linux_packages.html#stable 找到链接,安装: rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm 查看: yum info nginx 安装: yum install nginx service nginx start yum install nginx,布

How to install nginx in Ubuntu

The steps for installing the nginx on Ubuntu below. 1.install the packages first. apt-get install gcc apt-get install libpcre3 libpcre3-dev apt-get install zlib1g zlib1g-dev apt-get install openssl openssl-dev 2.download the source code of nginx from

centos6.5 64位 yum install nginx的默认安装路径

yum install nginx网站文件存放默认目录 /usr/share/nginx/html 网站默认站点配置 /etc/nginx/conf.d/default.conf 自定义Nginx站点配置文件存放目录 /etc/nginx/conf.d/ Nginx全局配置 /etc/nginx/nginx.conf chkconfig nginx on开机启动 chkconfig --list

[mac]brew install nginx,出现编译错误怎么办?

错误如下: ==> Downloading http://nginx.org/download/nginx-1.6.2.tar.gz Already downloaded: /Library/Caches/Homebrew/nginx-1.6.2.tar.gz ==> ./configure --prefix=/usr/local/Cellar/nginx/1.6.2 --with-http_ssl_module --with-pcre --with-ipv6 --sbin-path=/usr

How To Install Nginx on CentOS 7(转)

How To Install Nginx on CentOS 7 PostedJuly 22, 2014 427.4kviews NGINX CENTOS About Nginx Nginx is a high performance web server software. It is a much more flexible and lightweight program than Apache HTTP Server. This tutorial will teach you how to

linux install nginx error

1 2 3 4 5 6 7 8 9 10 11 [[email protected] nginx-1.2.9]$ make make -f objs/Makefile make[1]: Entering directory `/home/mahao01/soft/nginx-1.2.9' cd /home/mahao01/local/pcre \ && if [ -f Makefile ]; then make distclean; fi \ && CC="gcc

CentOS 7 install Nginx

1. rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm 2. yum install -y nginx 3. systemctl start nginx.service

install nginx - source

OS: centos7 minimal 0. prepare 1) gcc $yum install gcc 2) PCRE $yum -y install pcre-devel 3) zlib $yum install zlib-devel 4) OpenSSL default directory: /usr/ssl (1) down $wget https://www.openssl.org/source/openssl-1.0.2o.tar.gz (2) perl $yum install