ラベル Apache の投稿を表示しています。 すべての投稿を表示
ラベル Apache の投稿を表示しています。 すべての投稿を表示

2016年8月31日水曜日

eコミュニティ・プラットフォーム - 6 eコミグループウェア インストールb

6-1 eコミグループウェアのインストール
6-1-1 ドメインの用意
「eコミグループウェアインストールマニュアル」の「1.1 ドメインの用意」を参考にします。

6-1-1-1 Apache の動作確認
このブログの「5 eコミマップ」の「5-1-2 Apache の動作確認」を実施していれば、Apache の動作確認はできています。

6-1-1-2 eコミグループウェアインストール用ディレクトリ作成
ここでは、CentOS の一般ユーザに gware を作成します。

端末を起動して root で
[user@centos6 ~]$ su -
パスワード:
[root@centos6 ~]# useradd gware
[root@centos6 ~]# passwd gware
ユーザー gware のパスワードを変更。
新しいパスワード:
新しいパスワードを再入力してください:
passwd: 全ての認証トークンが正しく更新できました。
[root@centos6 ~]# ls /home
gware lost+found  map  user

Web サーバとポートの設定
このブログの「5 eコミマップ」の「5-1-6-7 Web サーバとポートの設定」を実施していれば、動作確認はできています。
HOSTNAME にサーバの FQDN が設定されていることを確認します。
[root@centos6 ~]# echo $HOSTNAME
centos6.myhome.net
利用する FQDN が 127.0.0.1 になっていることを確認します。
[root@centos6 ~]# cat /etc/hosts
127.0.0.1   centos6.myhome.net
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
「ユーザーディレクトリ作成(/~ユーザー名/)(https://centossrv.com/apache-userdir.shtml)」を参考に、gware(一般)ユーザがホームページを提供できるようにします。
root@centos6 ~]# vim /etc/httpd/conf/httpd.conf
---
<IfModule mod_userdir.c>
    #
    # UserDir is disabled by default since it can confirm the presence
    # of a username on the system (depending on home directory
    # permissions).
    #
    #UserDir disabled  #を追加(コメントアウト)

    #
    # To enable requests to /~user/ to serve the user's public_html
    # directory, remove the "UserDir disabled" line above, and uncomment
    # the following line instead:
    # 
    UserDir public_html
    # 行頭の # を削除(コメント解除)
    AliasMatch ^/gware(.*) /home/gware/public_html/$1
    # gwareユーザのみ http://centos6.myhome.net/gware/ のように ~(チルダ)
    # なしでアクセスできるようにします。

</IfModule>
#
# Control access to UserDir directories.  The following is an example
# for a site where these directories are restricted to read-only.
#
#<Directory /home/*/public_html>
#    AllowOverride FileInfo AuthConfig Limit
#    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
#    <Limit GET POST OPTIONS>
#        Order allow,deny
#        Allow from all
#    </Limit>
#    <LimitExcept GET POST OPTIONS>
#        Order deny,allow
#        Deny from all
#    </LimitExcept>
#</Directory>
# 以下を追加
<Directory /home/*/public_html>
    AllowOverride All
    # .htaccess の許可
    Options IncludesNoExec ExecCGI FollowSymLinks
    # CGI, SSI(Exec 命令以外)の許可
    <Limit GET POST OPTIONS>
        Order allow,deny
        Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS>
        Order deny,allow
        Deny from all
    </LimitExcept>
</Directory>
---
Web サーバ(Apache)を再起動します。
[root@centos6 ~]# /etc/init.d/httpd restart
httpd を停止中:                                            [  OK  ]
httpd を起動中:                                            [  OK  ]
[root@centos6 ~]# exit
logout
[user@centos6 ~]$ su - gware
パスワード:
[gware@centos6 ~]$ mkdir public_html
[gware@centos6 ~]$ ls
public_html
[gware@centos6 ~]$ cd public_html/
[gware@centos6 public_html]$ vim index.html
Webブラウザ(Firefox)のアドレス欄に「http://centos6.myhome.net/gware/」と入力して Enter キーを押します。


上記のように表示されました。「CentOS 6.5 で ユーザーディレクトリに public_html を作り、その中の html ファイルを Apache で公開するためには(http://tsujimotter.hatenablog.com/entry/2014/06/20/184945)」の「パーミッションの設定」を参考に、/home/gware のパーミッションを次のように変更します。
[root@centos6 ~]# ls -l /home
合計 28
drwx------.  5 gware gware  4096  7月 11 11:12 2016 gware
---
[root@centos6 ~]# chmod 701 /home/gware
[root@centos6 ~]# ls -l /home
合計 28
drwx-----x.  5 gware gware  4096  7月 11 11:12 2016 gware
---
Webブラウザ(Firefox)のアドレス欄に「http://centos6.myhome.net/gware/」と入力して Enter キーを押します。


上記のように表示されました。「SELinux有効下でのユーザ毎のディレクトリを公開する(http://park1.wakwak.com/~ima/centos4_apache0005.html)」の「SELinux有効の場合の追加設定」を参考に、次のコマンドを実行します。
[root@centos6 ~]# restorecon /home/gware/public_html
[root@centos6 ~]# restorecon -R /home/gware/public_html
Webブラウザ(Firefox)のアドレス欄に「http://centos6.myhome.net/gware/」と入力して Enter キーを押します。


2016年7月9日土曜日

eコミュニティ・プラットフォーム - 5 eコミマップ インストールk

5-1 eコミマップのインストール
5-1-6 eコミマップのインストール
5-1-6-7 Web サーバとポートの設定
「3.8 Web サーバとポートの設定」を参考にします。
Web サーバの設定ファイルをバックアップします。

[map@centos6 ~]$ exit
logout
[user@centos6 ~]$ su -
パスワード:
[root@centos6 ~]# cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf_bak

HOSTNAME にサーバの FQDN が設定されていることを確認します。

[root@centos6 ~]# echo $HOSTNAME
centos6.myhome.net

利用する FQDN が 127.0.0.1 になっていることを確認します。(とりあえず、以下のままで進めます。)
[root@centos6 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@centos6 ~]# cd /home/map
[root@centos6 map]# sh proxypass.sh $HOSTNAME >> /etc/httpd/conf.d/mod_proxy.conf
Web サーバ(Apache)を再起動します。
[root@centos6 ~]# /etc/init.d/httpd restart
httpd を停止中:                                            [  OK  ]
httpd を起動中: httpd: apr_sockaddr_info_get() failed for centos6.myhome.net
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
                                                           [  OK  ]
上記のように表示されたので、/etc/hosts を修正します。
[root@centos6 ~]# vim /etc/hosts
127.0.0.1   centos6.myhome.net
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@centos6 ~]# /etc/init.d/httpd restart
httpd を停止中:                                            [  OK  ]
httpd を起動中:                                            [  OK  ]

eコミュニティ・プラットフォーム - 5 eコミマップ インストールb

5-1 eコミマップのインストール
5-1-2 Apache の動作確認
Apache が動作しているか確認します。

インストールの確認
[user@centos6 ~]$ rpm -qa | grep httpd
httpd-tools-2.2.15-47.el6.centos.4.x86_64
httpd-2.2.15-47.el6.centos.4.x86_64

動作の確認は、Web ブラウザ(FireFox)のアドレス欄に「http://localhost」と入力して Enter キーを押します。
次のように表示されました。


現在の設定状態を確認します。

[user@centos6 ~]$ chkconfig --list | grep httpd
httpd          0:off    1:off    2:off    3:off    4:off    5:off    6:off

OS 起動時に自動起動する設定がされていませんでした。
Apache を起動します。root ユーザで

[user@centos6 ~]$  su -
パスワード:
[root@centos6 ~]# /etc/init.d/httpd start
httpd を起動中: httpd: apr_sockaddr_info_get() failed for centos6.myhome.net
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

アドレス欄に「http://localhost」と入力して Enter キーを押します。


起動時に自動起動する設定をします。

[root@centos6 ~]# chkconfig httpd on
[root@centos6 ~]# chkconfig --list | grep httpd
httpd          0:off    1:off    2:on    3:on    4:on    5:on    6:off

2008年6月18日水曜日

ka-Map 4Apacheの設定

Webサーバ・エイリアス にあるように、手動でApacheの設定をします。
設定ファイルは次のディレクトリにあります。

#ls /etc/apache2/sites-available
default

有効になっているファイルは次のディレクトリで分かります。

#ls /etc/apache2/sites-enabled
000-default

defaultファイルをkamapという名前でコピーして修正します。
コピーに問題があった場合にdefaultを有効にしなおします。

#cp /etc/apache2/sites-available/default /etc/apache2/sites-available/kamap

kamapファイルに次のように追加します。userの部分は自分の環境に合わせて換えてください。
(vimなどエディタを使い慣れていない人は
#gedit /etc/apache2/sites-available/kamap
で使い慣れた操作ができるテキスト・エディタが起動します。)

<VirtualHost>
---
Alias /ka-map/ "/home/user/ka-map/htdocs/"
<Directory /home/user/ka-map/htdocs/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
---
</VirtualHost>

defaultの設定を無効にして、kamapの設定を有効にします。

#a2dissite default
#a2ensite kamap

続く...

2008年6月11日水曜日

Apacheのインストールと設定

Apacheをインストールします。
インストールは、Synapticパッケージマネージャを使います。
apache2を検索して、apache2をインストール指定します。
依存により要求された変更を追加しますか?と表示されたら、このままマークボタンをクリックします。
適用ボタンをクリックします。
以下の変更を適用しますか?と表示されたら、適用ボタンをクリックします。
インストールが終わったら、変更を適用しました。と表示されるので閉じるボタンをクリックします。

インストール後は自動的に起動しています。
次の手順で確かめます。
Webブラウザ(Iceweasel[FireFoxのDebian版])を起動します。
アプリケーション−インターネット−Iceweaselウェブ・ブラウザまたはパネルのショートカット
アドレスバーに次のように入力してEnterキーを押します。

http://localhost/

It works!と表示されればOK。


Apacheを設定します。
設定ファイルを見てみましょう。
Root Terminalを起動します。(一般ユーザでsuでもOK。)パスワードを聞いてきたら、rootのパスワードを入力してください。
エディタ(私はvimを使っています。)で次のファイルを開きます。
/etc/apache2/sites-available/default
(#vim /etc/apache2/sites-available/default と入力してEnterキーを押します。
最初の#はrootを表していて(一般ユーザは$)、初めから表示されているので、続けてvim、1つスペースを入れてそれ以降を入力します。)
DocumentRootのディレクトリのファイルがブラウザで表示されます。

DocumentRoot /var/www/

次のように入力して終了します。

:q

このディレクトリのリストを表示してみます。

#ls /var/www/
index.html

http://localhost/で表示されたファイルがこれになります。

エディタで次のファイルを開きます。
/etc/apache2/envvars
export APACHE_RUN_USERのユーザwww-dataがApacheユーザになります。
この場合グループもwww-dataです。

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

エディタを終了します。