如何在Azure WebApp上部署Laravel和Vue Spa?

ldioqlga  于 2023-05-01  发布在  Vue.js
关注(0)|答案(1)|浏览(154)

我已经创建了webapp并使用ftp上传了我的代码,,然后创建cd /home/site/ext并在上面安装composer和nodenpm,,然后使用npm run pod构建代码并成功编译,,我使用spa laravel vue,,,然后将url放在我的.env和snacturm文件,默认文件看起来像下面的laravel根,,,注意,我已经测试了应用程序的共享主机,它的工作以及本地主机的罚款,

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.com www.example.com; 

    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;
    }
}

拉腊根中的刺

<IfModule mod_rewrite.c>
    RewriteEngine on

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

但是当我访问这个网站的时候,它显示403禁止,注意这是laravel vue spa,所有的东西都是在laravel内部构建的,没有分离,

pod7payv

pod7payv1#

你是否创建了一个脚本来在每次执行部署时复制nginx默认文件?我对此表示怀疑,因为当管道运行时,服务器会重新启动,主文件夹之外的所有内容都会重置,包括nginx配置文件。
看看这篇文章:https://techcommunity.microsoft.com/t5/apps-on-azure-blog/configure-nginx-for-php-8-linux-azure-app-service/ba-p/3069373

相关问题