-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from yihong1120/feature/separation-of-front-an…
…d-back-ends Feature/separation of front and back ends
- Loading branch information
Showing
29 changed files
with
396 additions
and
524 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
server { | ||
# Listen on port 80 (HTTP) | ||
listen 80; | ||
server_name changdar-server.mooo.com; | ||
|
||
# Set the root directory for the website, pointing to the dist folder of the frontend build | ||
root /var/www/html; | ||
|
||
# Specify the default homepage file | ||
index index.html; | ||
|
||
# Handle static file requests | ||
location / { | ||
# Check if the requested file exists, otherwise fallback to index.html (for SPA) | ||
try_files $uri /index.html; | ||
} | ||
|
||
# Proxy /api requests to the backend service | ||
location /api/ { | ||
proxy_pass http://127.0.0.1:8800; # Backend service address | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
|
||
# Necessary configuration to support WebSocket upgrades | ||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
} | ||
|
||
# Configure caching for static assets | ||
location ~* \.(?:ico|css|js|gif|jpe?g|png|woff2?|eot|ttf|svg|mp4)$ { | ||
expires 6M; | ||
access_log off; | ||
add_header Cache-Control "public"; | ||
} | ||
|
||
# Configure the 404 error page | ||
error_page 404 /index.html; | ||
|
||
# Handle WebSocket live streaming on a specific route (if required) | ||
location /ws/ { | ||
proxy_pass http://127.0.0.1:8800; # Backend WebSocket service address | ||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
} | ||
} |
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
File renamed without changes.
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
File renamed without changes.
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
Oops, something went wrong.