LoginSignup
0
0

apache2で静的ページを動かす最短メモ

Last updated at Posted at 2017-01-24

apacheインストール(ubuntu14)

sudo apt-get install apache2

#ユーザーの設定

sudo chgrp -R グループ名 www
sudo chmod g+w www
sudo chmod g+w /var/www/html

configファイルの設定

/etc/apache2/apache2.confを編集
Enabling conf

ルートディレクトリーを公開する

/var/www/html配下にあるファイルを公開する。

DocumentRoot "/var/www/html"

ドキュメントルート以外を公開する

/var/www/html/xxxx配下にあるファイルを公開する。
URLは/xxx1で通信。

Alias /xxx1 "/var/www/html/xxxx"
<Directory "/var/www/html/xxxx">
    AllowOverride None
    Require all granted
</Directory>

sudo a2enconf php5-cgi.conf

#リンクを貼りたい場合
sudo ln -s [貼りたいフォルダのパス] /var/www/html/hogehoge

#apache再起動
sudo /etc/init.d/apache2 restart

#動作確認
http://localhost/
http://サーバーのIP/
http://サーバーのIP:サーバーのポート/

#うまくいかない場合はエラーを確認
tail /var/log/apache2/access.log
tail /var/log/apache2/error.log

#参考
http://ctips.slackhack.net/linux/ubuntu/88/

basic認証
http://qiita.com/shell/items/5606d37a802e39479036
簡易phpページ
http://qiita.com/miyamotok0105/items/851a5e27629bfd1e3226

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