一、虚拟机准备:
[root@localhost 桌面]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.59.1 #注意虚拟机的IP与宿主机的内网IP不能相同
NETMASK=255.255.255.0
GATEWAY=192.168.59.2
DNS1=222.246.129.80
DNS2=114.114.114.114
[root@localhost 桌面]# ifconfig eth0 on #启动eth0网卡
[root@localhost 桌面]# service network restart #重启启动网络服务,使得刚才的配置生效
至此NAT模式下实现虚拟机对外部网络访问功能已经配置完成。
1.安装make
yum -y install gcc automake autoconf libtool make yum install gcc gcc-c++ 2.安装pcre cd /usr/local/src wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz tar -zxvf pcre-8.37.tar.gz cd pcre-8.34 ./configure make make install 3.安装zlib cd /usr/local/src wget http://zlib.net/zlib-1.2.11.tar.gz tar -zxvf zlib-1.2.11.tar.gz cd zlib-1.2.11 ./configure make make install 4.安装openssl cd /usr/local/src wget https://www.openssl.org/source/openssl-1.0.1t.tar.gz tar -zxvf openssl-1.0.1t.tar.gz 5.安装nginx cd /usr/local/src wget http://nginx.org/download/nginx-1.1.10.tar.gz tar -zxvf nginx-1.1.10.tar.gz cd nginx-1.1.10 ./configure make make install yum -y install openssl openssl-devel
nginx启动命令:
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
启动失败:
ln -s /usr/local/lib/libpcre.so.1 /lib
nginx停止命令:
ps -ef|grep nginx
kill -INT 2132
pkill -9 nginx
nginx重启命令:
./nginx -s reload