LoginSignup
0
0

More than 5 years have passed since last update.

バーチャルホスト の設定(Amazon Linuxにて)

Last updated at Posted at 2019-01-21

背景

先日設定したawsのlaravelの環境で、そのままだとphpMyAdminが参照できなくなるので、バーチャルホストを設定しました。

※できるだけ無料でやりたいので、DNSはRoute 53を使わず、ムームーDNSを使用。ホントは使いたい、、、

手順

xxx.com → laravelサイトを参照
xxx.com/tools/phpMyAdmin → phpMyAdminを参照

上記になるようにバーチャルホスト を設定する。

$ sudo vi /etc/httpd/conf.d/custom.conf

<VirtualHost *:80>
  DocumentRoot /var/www/test-laravel/public
  ServerName xxx.com

  #/tools で/var/www/htmlにエイリアス
  Alias /tools /var/www/html

  #test-laravel/public以下が参照されるように変更。
  <Directory "/var/www/test-laravel/public">
    AllowOverride All
    Require all granted
  </Directory>
</VirtualHost>

できた

xxx.com
test-laravel 2019-01-22 07-33-13.png

xxx.com/tools/phpMyAdmin
phpMyAdmin2019-01-22 07-31-19.png

追記

今のままだと、urlを間違った時にディレクトリー一覧が表示されセキュリティー上よくない。
index2019-01-22 07-14-41.png

$sudo vi /etc/httpd/conf/httpd.conf

下記のように変更

Options Indexes FollowSymLinks
↓
#Options Indexes FollowSymLinks
Options FollowSymLinks

表示されなくなりました。
index2019-01-22 07-16-38.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0