代码拉取完成,页面将自动刷新
Modify the local host to match the local domain name
CD C:\Windows\System32\drivers\etc
127.0.0.1 www.51xuecheng.cn 51xuecheng.cn ucenter.51xuecheng.cn teacher.51xuecheng.cn file.51xuecheng.cn
Open Nginx configuration
http {
server_names_hash_bucket_size 64;
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
client_max_body_size 20m;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
#文件服务
upstream fileserver{
server 1.117.60.49:9000 weight=10;
}
#后台网关
upstream gatewayserver{
server 127.0.0.1:63010 weight=10;
}
#前端开发服务
upstream uidevserver{
server 127.0.0.1:8601 weight=10;
}
#主页面代理
server {
listen 80;
server_name www.51xuecheng.cn localhost;
#rewrite ^(.*) https://$server_name$1 permanent;
#charset koi8-r;
ssi on;
ssi_silent_errors on;
#access_log logs/host.access.log main;
location / {
alias P:/AllStackStudy/xuecheng/xc-ui-pc-static-portal/;
index index.html index.htm;
}
#api nginx分发
location /api/ {
proxy_pass http://gatewayserver/;
}
#openapi
location /open/content/ {
proxy_pass http://gatewayserver/content/open/;
}
location /open/media/ {
proxy_pass http://gatewayserver/media/open/;
}
location /course/ {
proxy_pass http://fileserver/mediafiles/course/;
}
#静态资源
location /static/img/ {
alias P:/AllStackStudy/xuecheng/xc-ui-pc-static-portal/img/;
}
location /static/css/ {
alias P:/AllStackStudy/xuecheng/xc-ui-pc-static-portal/css/;
}
location /static/js/ {
alias P:/AllStackStudy/xuecheng/xc-ui-pc-static-portal/js/;
}
location /static/plugins/ {
alias P:/AllStackStudy/xuecheng/xc-ui-pc-static-portal/plugins/;
add_header Access-Control-Allow-Origin http://ucenter.51xuecheng.cn;
add_header Access-Control-Allow-Credentials true;
add_header Access-Control-Allow-Methods GET;
}
location /plugins/ {
alias P:/AllStackStudy/xuecheng/xc-ui-pc-static-portal/plugins/;
}
location /course/preview/learning.html {
alias P:/AllStackStudy/xuecheng/xc-ui-pc-static-portal/course/learning.html;
}
location /course/search.html {
root P:/AllStackStudy/xuecheng/xc-ui-pc-static-portal;
}
location /course/learning.html {
root P:/AllStackStudy/xuecheng/xc-ui-pc-static-portal;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
#教师模块
server {
listen 80;
server_name teacher.51xuecheng.cn;
#charset koi8-r;
ssi on;
ssi_silent_errors on;
#access_log logs/host.access.log main;
#location / {
# alias D:/itcast2022/xc_edu3.0/code_1/dist/;
# index index.html index.htm;
#}
location / {
proxy_pass http://uidevserver;
}
location /api/ {
proxy_pass http://gatewayserver/;
}
}
#用户中心
server {
listen 80;
server_name ucenter.51xuecheng.cn;
#charset koi8-r;
ssi on;
ssi_silent_errors on;
#access_log logs/host.access.log main;
location / {
alias D:/itcast2022/xc_edu3.0/code_1/xc-ui-pc-static-portal/ucenter/;
index index.html index.htm;
}
location /include {
proxy_pass http://127.0.0.1;
}
location /img/ {
proxy_pass http://127.0.0.1/static/img/;
}
location /api/ {
proxy_pass http://gatewayserver/;
}
}
#文件上传
server {
listen 80;
server_name file.51xuecheng.cn;
#charset koi8-r;
ssi on;
ssi_silent_errors on;
#access_log logs/host.access.log main;
location /video {
proxy_pass http://fileserver;
}
location /mediafiles {
proxy_pass http://fileserver;
}
}
}
TODO
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。