如何配置Quasar项目在Apache虚拟主机上运行
在domain.local部署Quasar项目的Apache配置
以下是用于在domain.local及所有子域名上运行Quasar项目的Apache虚拟主机配置:
ServerName domain.local ServerAlias *.domain.local DocumentRoot /project/ <Directory "/project/"> AllowOverride All Require all granted <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.html$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.html [L] </IfModule> </Directory>
配置要点说明
ServerName与ServerAlias指定站点主域名及所有子域名,确保*.domain.local的请求都指向该项目DocumentRoot需指向Quasar项目打包后的输出目录,确认/project/下存在index.html及静态资源文件- 启用
mod_rewrite是为了适配Quasar的SPA路由规则,将所有非文件、非目录的请求转发到index.html,避免路由跳转404 AllowOverride All允许通过.htaccess文件自定义额外的配置规则
内容的提问来源于stack exchange,提问作者user15539888
相关产品推荐
相关产品推荐

