最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

网站源码admin37浏览0评论

如何在 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

发布评论

评论列表(0)

  1. 暂无评论