1
2
3
4
5
6
7
8
|
[root@web nginx]
# mkdir -pv /data/www
mkdir
: 已创建目录
"/data/www"
[root@web nginx]
# cd /data/www
[root@web www]
# ll
总用量 0
[root@web www]
# cat index.html
<h1>www.nginx.org<
/h1
>
[root@web www]
# chown -R nginx.nginx /data/www/*
|
1
2
3
4
5
6
|
[root@web ~]
# cd /etc/nginx/
[root@web nginx]
# cp nginx.conf nginx.conf.bak
[root@web nginx]
# ls
fastcgi.conf fastcgi_params.default mime.types nginx.conf.bak scgi_params.default win-utf
fastcgi.conf.default koi-utf mime.types.default nginx.conf.default uwsgi_params
fastcgi_params koi-win nginx.conf scgi_params uwsgi_param
|
1
2
3
4
5
6
7
8
9
10
|
[root@web www]
# vim /etc/nginx/nginx.conf
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root
/data/www
;
index index.html index.htm;
}
|
1
2
3
4
|
[root@web run]
# service nginx reload
nginx: the configuration
file
/etc/nginx/nginx
.conf syntax is ok
nginx: configuration
file
/etc/nginx/nginx
.conf
test
is successful
重新载入 nginx: [确定]
|
http://localhost/ 访问index.html页面