
|
 |
さて、いつもは、左図のようにGUI で設定を行うのですが、今回は Virtialhost 設定等の変更がかなり多くなりますので /etc/httpd/conf/httpd.conf
を直接編集します。
(GUI で設定を行うと /etc/httpd/conf.d/system-config-httpd.conf を編集することになります。)
|

|
|
root 権限でログイン後、 コンピュータを開き /etc/httpd/conf/httpd.conf を ダブルクリックします。
変更箇所は以下の通りです。
|
|
元ファイルの内容
Listen 80
ServerTokens OS
Include conf.d/*.conf
ServerAdmin root@localhost
#ServerName www.example.com:80
DocumentRoot "/var/www/html"
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
AddDefaultCharset UTF-8
#NameVirtualHost *:80

|
|
変更後ファイルの内容
Listen 192.168.xxx.xxx:80 XXX は使用環境に合わせる
ServerTokens Prod OSを表示しない
#Include conf.d/*.conf GUI設定情報等を無効にする
ServerAdmin webmaster takajun.net error 発生画面の e-mail 表示変更
ServerName www.takajun.net:80 Main Host名の変更
DocumentRoot "/hogehoge/www/takajun" Webserver で公開するディレクトリ変更
<Directory "/hogehoge/www"> 各種制限を行うディレクトリの設定
Options Indexes index.html がない場合にファイル一覧を表示する場合のみ変更
AllowOverride All .htaccess ファイルでアクセス制限を行う
Order allow,deny
Allow from all
</Directory>
<Directory "/hogehoge/www/takajun/cgi-bin"> CGIを実行するディレクトリ変更
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
AddDefaultCharset off 日本語表記の文字化け対策(必須)
NameVirtualHost 192.168.xxx.xxx:80 VirtualHost設定(NICのアドレス)
<VirtualHost 192.168.xxx.xxx:80> Main Host 内容の繰り返し
ServerAdmin webmaster takajun.net
DocumentRoot /hogehoge/www/takajun
ServerName www.takajun.net
ScriptAlias /cgi-bin/ "/hogehoge/www/takajun/cgi-bin/"
ErrorLog /hogehoge/log/takajun-error_log
CustomLog /hogehoge/log/takajun-referer_log referer
CustomLog /hogehoge/log/takajun-access_log common
</VirtualHost>
|
|
|
<VirtualHost 192.168.xxx.xxx:80> ここから Virtualhost の内容設定開始
ServerAdmin webmaster systemtrade.net
DocumentRoot /hogehoge/www/systemtrade
ServerName www.systemtrade.net
ScriptAlias /cgi-bin/ "/hogehoge/www/systemtrade/cgi-bin/"
ErrorLog /hogehoge/log/systemtrade-error_log
CustomLog /hogehoge/log/systemtrade-referer_log referer
CustomLog /hogehoge/log/systemtrade-access_log common
</VirtualHost>
<VirtualHost 192.168.xxx.xxx:80>
ServerAdmin webmaster systemtrade.net
DocumentRoot /hogehoge/www/systemtrade
ServerName www.systemtrade.net
ScriptAlias /cgi-bin/ "/data/www/systemtrade/cgi-bin/"
ErrorLog /hogehoge/log/systemtrade-error_log
CustomLog /hogehoge/log/systemtrade-referer_log referer
CustomLog /hogehoge/log/systemtrade-access_log common
</VirtualHost>
以下必要な Virtualhost を追記する。 |


|
|
httpd.conf の設定が終わると システム - 管理 - サーバー設定 - Services を選択します。
httpd にチェックを入れ 起動 を確認します。既に起動していた場合は、再起動 をクリックします。
再起動できない場合は GNOME端末を立ち上げて
# http -S (Sは大文字)
と打ち込みます。
VirtualHost configuration:
192.168.xxx.xxx:80 is a NameVirtualHost
default server www.takajun.net (/etc/httpd/conf/httpd.conf:1013)
port 80 namevhost www.takajun.net (/etc/httpd/conf/httpd.conf:1013)
port 80 namevhost www.systemtrade.net (/etc/httpd/conf/httpd.conf:1071)
Syntax OK
と Virtualhost がキチンと表示され Syntax OK が出るか確認をしてください。
# http -S も動作しない場合は # http と打ち込んで、Syntax Erroer を潰してください。
|