angularjs - 您无权访问此资源 [在 apache 上部署 Angular 时]
问题描述
码头工人撰写
version: "2"
services:
django-apache2:
build: .
container_name: django-apache2
ports:
- '8005:80'
volumes:
- ./www:/var/www/html/django_demo_app
- ./angular/dist/ng7:/var/www/dist
- ./demo_site.conf:/etc/apache2/sites-available/000-default.conf
泊坞窗文件
FROM python:3.7-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
apt-utils \
vim \
curl \
apache2 \
apache2-utils
RUN apt-get -y install \
libapache2-mod-wsgi-py3
ADD ./demo_site.conf /etc/apache2/sites-available/000-default.conf
COPY ./www /var/www/html
COPY ./angular/dist/ng7 /var/www/html/dist
EXPOSE 80
RUN rm /var/www/html/index.html
RUN chmod -R 777 /var/www/html/dist/index.html
CMD ["apache2ctl", "-D", "FOREGROUND"]
demo_site.conf
<VirtualHost *:80>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/dist
Alias "/" "/var/www/html/dist"
<Directory "/var/www/html/dist">
Options FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
我运行ng build
并将包含 index.html 的构建工件放置在/var/www/html/dist
.
我被禁止了 您无权访问此资源。在点击 localhost:8005 之后。
我在这里想念什么?
解决方案
推荐阅读
- reactjs - 在 ReactJS 中的兄弟姐妹之间共享状态(状态不在父级中)
- reactjs - react中的statement中的statement怎么做?
- testing - Postman 中的循环请求(使用 POST 请求)
- sql - 在列中将“the”更改为“The”
- python - 将无效的 url 重新路由回 django 中的主页
- java - 自动化测试用例适用于 appium 命令行工具,但不适用于桌面客户端
- oracle - 如果日期是 2 月 28 日,则 add_months 和 to_date 的组合出错
- kubernetes - GCR 在拉取 docker 图像时非常慢
- ffmpeg - Testcafe黄瓜记者视频录制
- r - 如何将电子邮件地址列表拆分为用户名和域?