apacheの設定

apacheはUbuntu Serverのインストール時に既に入ったようでしたので,設定だけ行いました。

$ cd /etc/apache2/sites-available
$ sudo cp default my_site
$ sudo vi my_site

<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName chitora.com

DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options -Indexes +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
$ sudo a2dissite default
$ sudo a2ensite my_site

変更点は,ServerNameの設定と,-Indexesの追加です。-Indexesで,ディレクトリ内容が表示されないようにします。

apacheを再起動します。

$ sudo /etc/init.d/apache2 restart

ブラウザから開けない! と思ったら,ufwの設定を忘れていました。

$ sudo ufw allow http

無事にブラウザから開くことができました。

apache

コメント

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です