use vue-client with nginx, so no CORS problems shoud be occure

This commit is contained in:
einhornimmond 2021-03-16 13:05:48 +01:00 committed by root
parent 1949260452
commit eabf0621fc
5 changed files with 36 additions and 16 deletions

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
*.log *.log
/node_modules/* /node_modules/*
.vscode

View File

@ -38,6 +38,10 @@ services:
## NGINX ################################################ ## NGINX ################################################
######################################################### #########################################################
nginx: nginx:
depends_on:
- frontend
- community-server
- login-server
volumes: volumes:
- ./logs:/var/log/nginx - ./logs:/var/log/nginx
@ -60,4 +64,4 @@ services:
volumes: volumes:
frontend_node_modules: frontend_node_modules:
conan: conan:

View File

@ -16,8 +16,6 @@ services:
target: production target: production
networks: networks:
- external-net - external-net
depends_on:
- nginx
ports: ports:
- 8080:8080 - 8080:8080
environment: environment:
@ -135,4 +133,4 @@ networks:
internal: true internal: true
volumes: volumes:
db_vol: db_vol:

View File

@ -15,6 +15,7 @@ module.exports = {
} }
}, },
lintOnSave: true, lintOnSave: true,
publicPath: '/vue/',
configureWebpack: { configureWebpack: {
// Set up all the aliases we use in our app. // Set up all the aliases we use in our app.
resolve: { resolve: {
@ -30,5 +31,6 @@ module.exports = {
css: { css: {
// Enable CSS source maps. // Enable CSS source maps.
sourceMap: process.env.NODE_ENV !== 'production' sourceMap: process.env.NODE_ENV !== 'production'
} },
outputDir: path.resolve(__dirname, "/vue" ),
}; };

View File

@ -12,15 +12,6 @@ server {
root /var/www/cakephp/webroot; root /var/www/cakephp/webroot;
index index.php; index index.php;
location ~* \.(png|jpg|ico|webp)$ {
expires 30d;
}
location ~* \.(js|css) {
# expires 1d;
expires 1d;
}
location ~ \.php$ { location ~ \.php$ {
fastcgi_pass community-server:9000; fastcgi_pass community-server:9000;
@ -67,9 +58,33 @@ server {
proxy_pass http://login-server:1201; proxy_pass http://login-server:1201;
proxy_redirect off; proxy_redirect off;
} }
location /vue {
location /vue/sockjs-node {
rewrite /vue/(.*) /$1;
}
location ~* \.(png) {
expires 1d;
rewrite /vue/(.*) /$1;
}
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
#rewrite /vue/(.*) /$1 break;
proxy_pass http://frontend:8080;
proxy_redirect off;
}
location / { location / {
try_files $uri $uri/ /index.php?$args; try_files $uri $uri/ /index.php?$args;
} }
# access_log /var/log/nginx/access.log main; # access_log /var/log/nginx/access.log main;