更改默认文档根后无法访问后端

时间:2017-01-12 08:37:18

标签: laravel amazon-web-services amazon-ec2 dns ubuntu-14.04

我最近在AWS ec2 ubuntu instance举办了一个网站。我的目录结构包含两个文件夹:

back (consists of laravel 5.2)
front (consists of index.html,css and javascript files)

我正在使用laravel作为后端。每当我访问我的网站时说 www.abc.com我正在获取默认的ubuntu页面。所以,我不得不手动访问www.abc.com/front/index.html。作为解决方法,我更改了Document root中的/etc/apache2/sites-available/000-default.conf/var/www/html/var/www/html/front。一切正常,除了一件事 - 我无法使用链接www.abc.com/back/public访问后备文件夹。 我认为正在发生的事情是我现在正在访问www.abc.com/front/back/public。 现在该怎么办?

000-default.conf:

<VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName www.example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/front

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    #LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    #Include conf-available/serve-cgi-bin.conf
 </VirtualHost>

1 个答案:

答案 0 :(得分:0)

DocumentRoot替换为

DocumentRoot /var/www/html/front/public

并将这些内容放入您的内容

<Directory /var/www/html/front/public>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>