AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / computer / 问题 / 1785175
Accepted
t_k
t_k
Asked: 2023-05-21 18:29:02 +0800 CST2023-05-21 18:29:02 +0800 CST 2023-05-21 18:29:02 +0800 CST

我无法在 apache2 中添加子页面

  • 772

使用液滴,Ubuntu 18.04.6 LTS (GNU/Linux 4.15.0-209-generic x86_64)和apache2: Server version: Apache/2.4.29 (Ubuntu) Server built: 2023-03-08T17:34:33。

我有myservice.com工作,我该如何添加myservice.com/app?

我在var/www/html/主页上。我制作了目录/var/www/html/app并将文件放在那里但它没有打开,Not Found发生错误(端口 443)。

如何判断apache2有一个子页面在./app?

我已经将配置文件编辑为sites-available:

<VirtualHost xxx.xx.xxx.xxx:80>
    ServerAdmin root@localhost
    ServerName myservice.com
    ServerAlias www.myservice.com
    DocumentRoot /var/www/html/dist
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    RewriteEngine on
    RewriteCond %{SERVER_NAME} =myservice.com [OR]
    RewriteCond %{SERVER_NAME} =www.myservice.com
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<VirtualHost xxx.xx.xxx.xxx:80>
    ServerName myservice.com/app
    DocumentRoot /var/www/html/app/dist
    RewriteEngine on
    RewriteCond %{SERVER_NAME} =myservice.com/app [OR]
    RewriteCond %{SERVER_NAME} =www.myservice.com/app
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

我也跑过sudo chmod -R 755 /var/www/myservice.com/app。

这是apache2.conf目录部分:

<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride ALL
        Require all granted
</Directory>

从 2005 年开始,我在网上找到了解决此问题的解决方案,但多年后我发现了相同的解决方案,例如。从2017年开始,那将行不通...

请告诉我我可以提供哪些有助于解决问题的进一步信息。

apache-http-server
  • 1 1 个回答
  • 11 Views

1 个回答

  • Voted
  1. Best Answer
    user1686
    2023-05-21T18:33:10+08:002023-05-21T18:33:10+08:00

    我在 var/www/html/ 主页。

    不,你不知道。您的 DocumentRoot 设置为,这意味着URL 应该位于./var/www/html/dist/app/var/www/html/dist/app

    (但是如果你特别想使用一个完全独立的目录——也就是说,如果你想让“子页面”存在于你的 DocumentRoot 之外——那么Alias可以用来定义一个备用位置。)

    • 0

相关问题

  • Apache 到 Nginx mod_rewrite 规则

  • 无法在本地主机中打开项目文件夹

  • Apache 两次发送 POST 请求

  • 是否可以将 Apache 配置为同一端口上的静态 Web 服务器和负载平衡器?

  • apache2 可以在没有 conf 文件的情况下工作吗?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何减少“vmmem”进程的消耗?

    • 11 个回答
  • Marko Smith

    从 Microsoft Stream 下载视频

    • 4 个回答
  • Marko Smith

    Google Chrome DevTools 无法解析 SourceMap:chrome-extension

    • 6 个回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Martin Hope
    Vickel Firefox 不再允许粘贴到 WhatsApp 网页中? 2023-08-18 05:04:35 +0800 CST
  • Martin Hope
    Saaru Lindestøkke 为什么使用 Python 的 tar 库时 tar.xz 文件比 macOS tar 小 15 倍? 2021-03-14 09:37:48 +0800 CST
  • Martin Hope
    CiaranWelsh 如何减少“vmmem”进程的消耗? 2020-06-10 02:06:58 +0800 CST
  • Martin Hope
    Jim Windows 10 搜索未加载,显示空白窗口 2020-02-06 03:28:26 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve