-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
45 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,44 @@ | ||
server { | ||
listen 80; | ||
server_name your-domain.com; # 你的域名 | ||
user nginx; | ||
worker_processes 1; | ||
|
||
root /usr/share/nginx/html; # Vue 应用打包后的文件存放目录 | ||
index index.html; | ||
error_log /var/log/nginx/error.log warn; | ||
pid /var/run/nginx.pid; | ||
|
||
location / { | ||
try_files $uri $uri/ /index.html; | ||
} | ||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
location /api/ { | ||
proxy_pass http://backend-service; # 后端 API 的地址 | ||
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_set_header X-Forwarded-Proto $scheme; | ||
} | ||
http { | ||
include /etc/nginx/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 /var/log/nginx/access.log main; | ||
|
||
sendfile on; | ||
#tcp_nopush on; | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
keepalive_timeout 65; | ||
|
||
#gzip on; | ||
|
||
server { | ||
listen 80; | ||
# server_name your-domain.com; # 你的域名 | ||
|
||
root /usr/share/nginx/html; # Vue 应用打包后的文件存放目录 | ||
index index.html; | ||
|
||
location / { | ||
try_files $uri $uri/ /index.html; | ||
} | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
</script> | ||
|
||
<template> | ||
|
||
dssddsdsds | ||
</template> | ||
|
||
<style lang="scss" scoped></style> |