五:安装防火墙
如果用的是centos6.8装默认是这个防火墙,不用安装,centos7.4默认是firewalld防火墙
,需要执行下面的步骤
1:systemctl stop firewalld
![]()
2:yum install iptables-services
3:systemctl enable iptables
4:systemctl start iptables
CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤。
1、关闭firewall:
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)
2、iptables防火墙(这里iptables已经安装,下面进行配置)
3、systemctlrestart iptables.service #最后重启防火墙使配置生效
systemctlenable iptables.service #设置防火墙开机启动
4、重启防火墙service iptables restart
5、防火墙启动后vim /etc/sysconfig/iptables
添加你要的规则:例如开启8080端口外网访问权限:-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
记住,不要加载最后面,加载默认的22端口下面即可,保存重启防火墙
六:安装nginx
1:先安装c++编译环境,还得安装gcc,
输入:yum install gcc-c++完成安装
2:下载安装包和nginx依赖包
wget
wget
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
还需要一个zlib-1.2.8安装包,手动去网上下吧,wget连接失效了。linux系统调用我在网上找的有很多
3:依次安装openssl-fips-2.0.9.tar.gz,zlib-1.2.8.tar.gz,pcre-8.38.tar.gz,nginx-1.8.0.tar.gz
4:tar -zxvf openssl-fips-2.0.9.tar.gz
cd openssl-fips-2.0.9
./config
make && make install
5:tar -zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure
make&& make install
6:tar -zxvf pcre-8.38.tar.gz
cd pcre-8.38
./configure
make&& make install
7:tar -zxvf nginx-1.8.0.tar.gz
cd nginx-1.8.0
./configure --with-pcre=../pcre-8.38--with-zlib=../zlib-1.2.8--with-openssl=../openssl-fips-2.0.9 (注意:./configure到/openssl-fips-2.0.9 ,这是一条命令请一起一赋值粘贴输入)
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-60262-2.html
看的很清楚
让市场妥协