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