nginxの簡単な設定例をみておきます。
最低限の設定は次のようになります。/var/www/htmlを用意して、下記を /etc/nginx/nginx.conf へ用意します。
worker_processes 1;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server {
listen 80;
server_name localhost;
location / {
root /var/www/html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html
location = /50x.html {
root /var/www/html;
}
}
}
/etc/nginx/mime.types には下記のような内容を置いておきます。対応するMIMEタイプを登録しておく必要があります。
types {
text/html html htm shtml;
}
/var/www/html/50x.html にはエラー発生時に表示するHTMLを置きます。CentOSへnginxリポジトリからnginxをインストールすると、サンプルが/usr/share/nginx/html/50x.html に用意されるので、それを参考にすると良いでしょう。Webサーバのドキュメントルートは、Apache HTTP Serverだと/var/www/html、nginxだと/usr/share/nginx/htmlとなるのが気にはなります。nginxを使うときに、/var/nginx の下を使うか/usr/share/nginx の下を使うかは好みで指定ということになりそうです。
準備ができたらnginxを起動すると動作します。ブラウザで http://localhost/ へアクセスすると確認ができます。