2017-01-12 6 views
0

私は最近、AWS ec2 ubuntu instanceにウェブサイトをホストしました。私のディレクトリ構造は2つのフォルダで構成されています。デフォルトのドキュメントルートを変更した後にバックエンドにアクセスできない

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に行く必要がありました。この問題を回避するため、/etc/apache2/sites-available/000-default.confDocument root/var/www/htmlから/var/www/html/frontに変更しました。 1つのことを除いてすべて正常に動作します - 私はリンクwww.abc.com/back/publicを使ってバックフォルダにアクセスすることができません。 私は現在、www.abc.com/ のフロント/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 [email protected] 
    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> 
+0

シェアの内側にこれらを入れて、あなたのapacheは、default.conf CONTENS – msonowal

+0

@msonowal私はdefault.confを追加しました – uttejh

+0

あなたは仮想ホストを作る必要があります:h ttps://httpd.apache.org/docs/2.4/vhosts/examples.html – Hammerbot

答えて

0

があなたのDocumentRoot

DocumentRoot /var/www/html/front/public 

を交換し、あなたのconf

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

のパブリックドメインを使用する必要はありませんが、パブリックファイルはバック・フォルダー – uttejh

+0

にあり、パスごとに変更するよりも – msonowal

関連する問題