如何在 azure webapp 上部署 laravel 和 vue spa?

编程入门 行业动态 更新时间:2024-10-02 12:22:52

<a href=https://www.elefans.com/category/jswz/34/1771448.html style=如何在 azure webapp 上部署 laravel 和 vue spa?"/>

如何在 azure webapp 上部署 laravel 和 vue spa?

我已经创建了 webapp 并使用 ftp 上传了我的代码,然后创建 cd /home/site/ext 并在其上安装 composer 和 nodenpm,然后使用 npm run pod 构建代码并成功编译,我正在使用 spa laravel vue ,,,然后将 url 放在我的 .env 和 snacturm 文件中,默认文件在 laravel root 中如下所示,注意我已经在共享托管上测试了该应用程序,它在本地主机上也运行良好,

server {
    #proxy_cache cache;
        #proxy_cache_valid 200 1s;
    listen 8080;
    listen [::]:8080;
    root /home/site/wwwroot/public; # changed for Laravel
    index  index.php index.html index.htm;
    server_name  example www.example; 

    location / {            
        try_files $uri $uri/ /index.php?$args; # changed for Laravel
    }

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /html/;
    }
    
    # Disable .git directory
    location ~ /\.git {
        deny all;
        access_log off;
        log_not_found off;
    }

    # Add locations of phpmyadmin here.
    location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
        fastcgi_pass 127.0.0.1:9000;
        include fastcgi_params;
        fastcgi_param HTTP_PROXY "";
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_intercept_errors on;
        fastcgi_connect_timeout         300; 
        fastcgi_send_timeout           3600; 
        fastcgi_read_timeout           3600;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 4 256k;
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;
    }
}

laravel 根目录中的 htacces

  <IfModule mod_rewrite.c>
    RewriteEngine on

    RewriteRule ^(.*)$ /public/$1 [NC,L,QSA]
</IfModule>

但是当我现在访问该站点时它显示 403 forbiden ,,请注意它是 laravel vue spa ,所有内容都在 laravel 内部构建而不是分离的,,,,

回答如下:

您是否创建了一个脚本来在每次执行部署时复制 nginx 默认文件?我对此表示质疑,因为当管道运行时,服务器会重新启动并且主文件夹之外的所有内容都会被重置,包括 nginx 配置文件。

看这篇文章:https://techcommunity.microsoft/t5/apps-on-azure-blog/configure-nginx-for-php-8-linux-azure-app-service/ba-p/3069373

更多推荐

如何在 azure webapp 上部署 laravel 和 vue spa?

本文发布于:2024-05-30 13:34:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1770550.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何在   azure   webapp   spa   vue

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!