Nginx 部署前后端在一个域名上,前端Vue + Laravel api
nginx.conf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | server { listen 80; server_name domain.cn; index index.html index.htm default.htm default.html; root /www/wwwroot/sitename/dist; location / { root /www/wwwroot/sitename/dist; try_files $uri $uri/ /index.html; index index.html default.htm default.html; } #PHP-INFO-START PHP引用配置,可以注释或修改 #include enable-php-00.conf; #PHP-INFO-END #REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效 #REWRITE-END location ~ /api/ { include enable-php-80.conf; root /www/wwwroot/laravel-project/public; if ( !-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; } #include /www/server/panel/vhost/rewrite/domian.cn.conf; if ( !-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; break; } } } |
上一篇:Phpstorm 安装Laravel 代码提示 代码跳转 laravel-ide-helper
支付宝扫一扫打赏
微信扫一扫打赏
共 0 条评论关于"Nginx 部署前后端分离项目在一个域名上,前端Vue + Laravel api, nginx前后端同域名配置"
最新评论