序言
此教程安装的都是最新版本的。由于是当NAS让它非常稳定的运行,所以能不安装的软件尽量不要安装。
一、准备工作
【更新系统】
没啥,就他喵想用个最新的。
右键点击开始键->设置->更新与安全
二、Smaba
【安装】
官方网站:https://www.samba.org/
命令流程:
1
2
3
4
|
cd /source/ wget https: //download .samba.org /pub/samba/samba-latest . tar .gz tar -zxvf samba-latest. tar .gz cd samba-latest |
【配置】
此处下载的是我用vs2017生成的asp.net core,仅供演示!
1
2
3
4
|
mkdir /web/www cd /web/www wget https: //files .cnblogs.com /files/project/webapp . tar .gz tar -zxf webapp. tar .gz |
三、Supervisor
【安装】
官方网站:http://www.supervisord.org/
命令流程:
1
|
yum install -y supervisor |
【配置】
1、复制文件
1
2
|
mkdir /web/supervisor cp /etc/supervisord .conf /web/supervisor |
2、打开supervisord.conf
1
|
vim /web/supervisor/supervisord .conf |
3、追加如下
1
2
3
4
5
6
7
|
[program:webapp] command =dotnet webapp.dll ;要执行的命令 directory= /web/www/ ;命令执行的目录 autostart= true ;是否自动启动 autorestart= true ;是否自动重启 stderr_logfile= /var/log/webapp .err.log ;标准错误日志 stdout_logfile= /var/log/webapp .out.log ;标准输出日志 |
【运行】
1
|
supervisord -c /web/supervisor/supervisord .conf |
四、Nginx
【安装】
官方网站:http://nginx.org/
命令流程:
1
2
|
rpm -Uvh http: //nginx .org /packages/centos/7/noarch/RPMS/nginx-release-centos-7-0 .el7.ngx.noarch.rpm yum install -y nginx |
【配置】
1、复制文件
1
2
3
|
mkdir /web/nginx cp /etc/nginx/nginx .conf /web/nginx cp /etc/nginx/mime .types /web/nginx |
2、打开nginx.conf
1
|
vim /web/nginx/nginx .conf |
3、修改如下
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application /octet-stream ; sendfile on; keepalive_timeout 65; gzip on; server { listen 80; server_name localhost; location / { proxy_pass http: //127 .0.0.1:5000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection keep-alive; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_cache_bypass $http_upgrade; } } } |
【运行】
1
|
nginx -c /web/nginx/nginx .conf |
五、效果预览
附、常用命令
nginx
1
2
3
|
# nginx //启动nginx # nginx -s reload //重启nginx # nginx -s stop //关闭nginx |
supervisor
1
2
3
4
5
|
supervisord supervisorctl status // 查看所有任务状态 supervisorctl shutdown // 关闭所有任务 supervisorctl start|stop|restart all // 控制所有进程 supervisorctl start|stop|restart program_name // 控制目标进程 |
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。
原文链接:https://www.cnblogs.com/project/p/9841039.html