Skip to content

Instantly share code, notes, and snippets.

@shellus
Last active July 31, 2018 02:28
Show Gist options
  • Save shellus/fef89a5cf23865c9a013fc0c4b70ebba to your computer and use it in GitHub Desktop.
Save shellus/fef89a5cf23865c9a013fc0c4b70ebba to your computer and use it in GitHub Desktop.
vue-router Vue路由+laravel后端的同域名解决跨域问题的nginx配置
server {
server_name love.endaosi.com;
charset utf-8;
location / {
index index.html;
root /data/www/love-vue/dist;
try_files $uri $uri/ /index.html;
}
location ~ /api {
try_files $uri /index.php?$args;
}
location ~ /storage {
try_files $uri =404;
}
location ~ \.php$ {
root /data/www/love/public;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
include fastcgi.conf;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/love.endaosi.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/love.endaosi.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = love.endaosi.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name love.endaosi.com;
return 404; # managed by Certbot
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment