
さてさて、前回ののつづきです。Webサイトを公開するためにはWebサーバーを構築しないといけませんので、Webサーバーパッケージhttpdを設定していきます。
その前に、iptablesでファイアー ウォールの構築をするのですが、ちょっと難しいので下記サイトを参考にしてください。
【参考】さくらのVPS を使いはじめる 3 – iptables を設定する
では、まずはhttpdがインストールされているか確認します。
# rpm -q httpd
httpd-2.2.3-83.el5.centos入ってますね。
Appachの各種設定するために、httpd.confを編集していきましょう。
# vi /etc/httpd/conf/httpd.confEnterを押して、
#
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
# consult the online docs. You have been warned.
#
# The configuration directives are grouped into three basic sections:
# 1. Directives that control the operation of the Apache server process as a
# whole (the 'global environment').
# 2. Directives that define the parameters of the 'main' or 'default' server,
# which responds to requests that aren't handled by a virtual host.
# These directives also provide default values for the settings
# of all virtual hosts.
# 3. Settings for virtual hosts, which allow Web requests to be sent to
.....だ〜と表示されますので、細かい文字の中からServerAdmin root@localhostを探して、サーバー管理者のメールアドレスに変更します。
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin root@localhost続けて#ServerName www.example.com:80という項目を探して、#を外しwww.example.com:80の部分をWebサイトのURLに使用するホスト名に書き換えます。今回はIPアドレスになります。さらに続けて、
Options FollowSymLinks ExecCGI IncludesNoExecを
Options -Includes FollowSymLinksに変更します。これでescキーを押して編集モードから抜け、
:wqEnterを押して保存します。
httpdを再起動します。
# /etc/rc.d/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]ServerNameで設定したIPアドレスにブラウザでアクセスしてみて下記のような表示が出れば成功です。

サーバーの起動と一緒に起動するように設定をして確認します。
# chkconfig httpd on
# chkconfig --list httpd
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:offとなっていればOK。
まだまだ先は長いです。続けてMySQLの設定をしていきます。
rpm -qa mysql-server
mysql-server-5.0.95-5.el5_9MySQLの文字コードを変更します。
vi /etc/my.cnf# character-set
default-character-set=utf8
skip-character-set-client-handshake# chkconfig mysqld on
# chkconfig --list mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:offを追記しておきます。vsftpdやhttpdのように自動起動にしたいので、
# /etc/rc.d/init.d/mysqld startMySQLを起動します。
# /etc/rc.d/init.d/mysqld startとりあえず、今日はここまで。





コメントを残す