1. 程式人生 > >nginx介紹(二) - 默認配置

nginx介紹(二) - 默認配置

rect include 插件 error_log 訪問 conn mat app orm

前言

  前面, 在瀏覽器中, 輸入linux 的ip, 出現了以下頁面:

  技術分享圖片

  那這個頁面在哪裏呢?

一. 工具 notepad++

在進入主題之前, 先來介紹下, 一會使用到的工具.

在notepad++裏面, 有個插件選項, 在插件選中選擇 Plugin Manager選項, 裏面只有兩個選擇, 點了之後, 你會知道點那個的.

技術分享圖片

安裝完成, 重啟之後, 會出現技術分享圖片 圖標, 點擊這個之後, 右邊會出現這個:

技術分享圖片

點擊小齒輪, 出現配置彈框, 配置一下

技術分享圖片

這時候, 就可以通過notepad++, 來訪問 linux 系統中的文件了. 非常的方便.

二. nginx默認配置

1. 進入到目錄中: /usr/local/nginx/conf

技術分享圖片

這裏有個nginx.conf配置文件, 打開它看看

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    
#log_format main ‘$remote_addr - $remote_user [$time_local] "$request" ‘ # ‘$status $body_bytes_sent "$http_referer" ‘ # ‘"$http_user_agent" "$http_x_forwarded_for"‘; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #
keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index 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; } } }

裏面很多註釋部分, 我刪除掉了. 主要來看一下 server 節點

技術分享圖片

根據這裏的路徑, 找到 index.html, 進行修改

技術分享圖片

我在後面加了個 default 顯示.

OK, 來刷新下頁面看看.

技術分享圖片

nginx介紹(二) - 默認配置