angularjs url重写不工作在运行apache2的docker容器
我正在尝试做一个angularJS应用程序在Docker容器上运行apache2(启用html5模式)的URL重写,
Dockerfile:
FROM httpd:2.4 RUN sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /usr/local/apache2/conf/httpd.conf COPY ./dist/ /usr/local/apache2/htdocs/
.htaccess文件位于index.html旁边的dist文件夹中
.htaccess文件:
RewriteEngine On # If an existing asset or directory is requested go to it as it is RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR] RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d RewriteRule ^ - [L] # If the requested resource doesn't exist, use index.html RewriteRule ^ /index.html
我试图在许多地方放置.htaccess文件(例如Dockerfile):
- COPY ./dist/.htaccess / usr / local / apache2 / htdocs /
- COPY ./dist/.htaccess / usr / local / apache2 /
- COPY ./dist/.htaccess / usr / local
- COPY ./dist/.htaccess / usr /
- COPY ./dist/.htaccess /
应用程序的行为没有改变。
如何testing服务器是否正在读取.htaccess文件?