nginx初体验
当我们安装完nginx后,我们首先进入nginx的安装目录,启动nginx的服务,然后在地址中输入 http://127.0.0.1/ , 然后我们就会看到”welcome to nginx“。
下面的代码为nginx.conf配置文件中的server段的默认配置,nginx所实现的功能都基于这个文件。我们将在后面的内容中继续进行讲解。
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /root; #定义服务器的默认网站根目录位置
index index.php index.html index.htm; #定义首页索引文件的名称
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}