以前写过一篇Ubuntu的环境搭建博客,感受一些配置大同小异,这里重点记录下 nginx 做为静态 angular 项目文件服务器的配置html
参考连接linux
Nginx配置nginx
muc api接口服务的配置,域名(api.wxsale.gedu.org)转发到5000端口web
以下:ubuntu
server { listen 80; server_name api.wxsale.gedu.org; root /app/web_root/api.wxsale.gedu.org; index index.html index.htm; try_files $uri $uri/ /index.html; 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_cache_bypass $http_upgrade; } error_page 404 /; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } access_log /applog/nginxlog/api.wxsale.gedu.org_access.log main; error_log /applog/nginxlog/api.wxsale.gedu.org_error.log; }
重点是配置域名,端口80指向5000,log日志文件路径api
而后是 angular 项目,静态文件转发配置服务器
以下:app
server { listen 80; server_name wxsale.gedu.org; location / { root /app/web_root/wxsale.gedu.org; index index.html index.htm; try_files $uri $uri/ /index.html; } error_page 404 /; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } access_log /applog/nginxlog/wxsale.gedu.org_access.log main; error_log /applog/nginxlog/wxsale.gedu.org_error.log; }
配置差很少。post
superior配置url
[program:GeduFileServer] command=dotnet GeduFileServer.dll --server.urls http://localhost:5100 directory=/app/web_root/file.wxsale.gedu.org environment=ASPNETCORE__ENVIRONMENT=Production user=root stopsignal=INT autostart=true autorestart=true startsecs=5 stderr_logfile=/app/web_root/file.wxsale.gedu.org/logfile/GeduDistributionApi.err.log stdout_logfile=/app/web_root/file.wxsale.gedu.org/logfile/GeduDistributionApi.out.log
这里能够指定服务端口号,就能够部署多个不一样端口的项目了