简体   繁体   English

无法使用虚拟主机在Apache Web服务器中部署angularjs应用

[英]Unable to deploy angularjs app in apache webserver using virtual hosts

This is on Mac OS X El Captain 这是在Mac OS X El Captain上

I am trying to deploy a web application built in Angularjs on Apache web server. 我正在尝试在Apache Web服务器上部署在Angularjs中构建的Web应用程序。

The folder is created in /Users/username/Sites/7MinutesWorkout 该文件夹在/ Users / username / Sites / 7MinutesWorkout中创建

For the same in order to enable virtual host, i uncommented the below line from httpd.conf 为了同样启用虚拟主机,我从httpd.conf中取消注释以下行

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

Also in httpd-vhosts.conf, included the below snippet 同样在httpd-vhosts.conf中,包含以下代码段

<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>

Also made entry in /etc/hosts as 还使/ etc / hosts中的条目为

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

Restarted apache by the command sudo apachectl restart 通过命令sudo apachectl restart重新启动apache

But when i try to access the site, i get the error page, this site cannot be reached. 但是,当我尝试访问该站点时,出现错误页面,无法访问该站点。

On executing the command 在执行命令时

apachectl configtest

gives the output as AH00526: Syntax error on line 47 of /private/etc/apache2/extra/httpd-vhosts.conf: Directory directive requires additional arguments 给出的输出为AH00526:/private/etc/apache2/extra/httpd-vhosts.conf的第47行的语法错误:目录指令需要其他参数

There is only one entry as of now in the httpd-vhosts.conf as specified above. 如上所述,到目前为止,httpd-vhosts.conf中只有一个条目。

Please suggest 请建议

I think your issue is with the Require all granted which needs to be present. 我认为您的问题在于Require all granted Here is the relevant part of my config, which works 这是我的配置的相关部分,可以正常工作

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM