家庭收支系统V4迁移到linux -5- 安装nginx

返回家庭收支系统V4迁移到linux目录
操作视频:https://www.ixigua.com/i6765127146089218564/

想来想去,最后决定用nginx作为web服务器部署收支系统的web端服务。

安装Nginx

安装

yum install nginx -y

查看版本

nginx -v
Nginx常用指令
systemctl start nginx  	#启动nginx服务
systemctl stop nginx 	#停止nginx服务
systemctl restart nginx #重启nginx服务
systemctl reload nginx	#重新加载nginx配置
systemctl enable nginx  #设置开机启动 
systemctl status nginx	#查看状态
异常

这里第一次启动nginx出现了启动失败的情况,用systemctl status nginx查看状态,发现是80端口被占用。
再用netstat -tpnul查看,发现是nginx自己占用了80端口,真是奇怪。
最后用ps aux |grep nginx找出nginx的进程ID,再用kill -9 加进程ID杀死nginx,然后在启动nginx就启动成功了。

配置

nginx的配置在:/etc/nginx/nginx.conf。
我们后面会给各站点独立新建配置放到目录:/etc/nginx/conf.d/里,所以可以把nginx.conf里的服务配置注释掉。
如下:

#    server {
#        listen       80 default_server;
#        listen       [::]:80 default_server;
#        server_name  _;
#        root         /usr/share/nginx/html;
#
#        # Load configuration files for the default server block.
#        include /etc/nginx/default.d/*.conf;
#
#        location / {
#        }
#
#        error_page 404 /404.html;
#            location = /40x.html {
#        }
#
#        error_page 500 502 503 504 /50x.html;
#            location = /50x.html {
#        }
#    }
附IOSysV4各服务配置

1.Web站点配置
新建配置iosysv4web.conf上传到/etc/nginx/conf.d/目录,并重载nginx:systemctl reload nginx。
iosysv4web.conf内容如下

server {
	listen       20002;	# 监听端口
	server_name  _;		# 站点域名

	location / {
		root	/usr/local/services/IOSysV4/WebVue;	# 站点根目录
		index	index.html;							# 默认导航页
	}
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值