1.安装依赖包
2.下载并解压安装包
3.安装nginx
4.配置nginx.conf
将端口号改成8089,因为可能apeache占用80端口,apeache端口尽量不要修改,我们选择修改nginx端口。 localhost修改为你服务器ip地址。 5.启动nginx
查看nginx进程是否启动: ps -ef | grep nginx
6.若想使用外部主机连接上虚拟机访问端口192.168.131.2,需要关闭虚拟机的防火墙: centOS6及以前版本使用命令: systemctl stop iptables.service centOS7关闭防火墙命令: systemctl stop firewalld.service 随后访问该ip即可看到nginx界面。
7.访问服务器ip查看
安装完成一般常用命令 进入安装目录中, 命令: cd /usr/local/nginx/sbin 启动,关闭,重启,命令: ./nginx 启动 ./nginx -s stop 关闭 ./nginx -s reload 重启 |
|