【问题标题】:Unable to deploy angularjs app in apache webserver using virtual hosts无法使用虚拟主机在 apache 网络服务器中部署 angularjs 应用程序
【发布时间】:2016-11-28 17:58:03
【问题描述】:

这是在 Mac OS X El Captain 上

我正在尝试在 Apache 网络服务器上部署一个用 Angularjs 构建的网络应用程序。

文件夹在 /Users/username/Sites/7MinutesWorkout 中创建

为了启用虚拟主机,我从 httpd.conf 中取消了以下行的注释

Include /private/etc/apache2/extra/httpd-vhosts.conf

同样在 httpd-vhosts.conf 中,包括下面的 sn-p

<VirtualHost *:80>
DocumentRoot "/Users/<username>/Sites/7MinutesWorkout"
ServerName 7MinutesWorkout.com
ServerAlias www.7MinutesWorkout.com
ServerAdmin <username>@dummy.com
ErrorLog "/private/var/log/apache2/7MinutesWorkout.com_error_log"
CustomLog "/private/var/log/apache2/7MinutesWorkout.com_access_log" common
<Directory>
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

在 /etc/hosts 中也做了条目

127.0.0.1    7MinutesWorkout.com
127.0.0.1    www.7MinutesWorkout.com

通过命令 sudo apachectl restart 重启 apache

但是当我尝试访问该站点时,我得到了错误页面,无法访问该站点。

在执行命令时

apachectl configtest

输出为 AH00526:/private/etc/apache2/extra/httpd-vhosts.conf 第 47 行的语法错误: 目录指令需要额外的参数

到目前为止,在上面指定的 httpd-vhosts.conf 中只有一个条目。

请推荐

【问题讨论】:

    标签: angularjs apache deployment


    【解决方案1】:

    我认为您的问题在于需要存在的 Require all granted。 这是我的配置的相关部分,它有效

    <Directory>
    Options Indexes FollowSymLinks
    
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All
    
    #
    # Controls who can get stuff from this server.
    #
    Require all granted
    #   onlineoffline tag - don't remove
     Order Allow,Deny
     Allow from all
    #     Allow from 127.0.0.1
    #     Allow from ::1
    #     Allow from localhost
    </Directory>
    

    【讨论】:

      猜你喜欢
      • 2012-04-13
      • 2010-12-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-18
      • 2021-05-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多