1. vi etc/hosts 에서 매크로를 변경함으로써 server_name을 변경할 수 있다.
127.0.0.1 localhost yunslee
2.
ip 통해서 nginx server에 접속하면, nginx의 config 파일에 의해 직접적인 서버에 접속하게된다.
1. port 번호에 의해서 라우팅을 해주고
2. server_name과 일치여부를 판단해준다.
server{
listen 80;
server_name 10.11.5.1;
index none;
location /{
autoindex on;
}
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
return 302 https://$server_name$request_uri;
root /var/www/html;
index index.html index.htm index.nginx-debian.html index.php;
server_name _;
location / {
autoindex on;
try_files $uri $uri/ =404;
}
}
3.\How nginx processes a request
http://nginx.org/en/docs/http/request_processing.html
How nginx processes a request
How nginx processes a request Name-based virtual servers nginx first decides which server should process the request. Let’s start with a simple configuration where all three virtual servers listen on port *:80: server { listen 80; server_name example.org
nginx.org
Server names
http://nginx.org/en/docs/http/server_names.html
Server names
Server names Server names are defined using the server_name directive and determine which server block is used for a given request. See also “How nginx processes a request”. They may be defined using exact names, wildcard names, or regular expressions:
nginx.org
'42cursus > server' 카테고리의 다른 글
docker toolbox 설치에러 해결하기 (0) | 2020.08.27 |
---|---|
ssl (0) | 2020.08.04 |
SSL, redirecct, autoindex, etc (0) | 2020.08.02 |
dockerfile (0) | 2020.07.30 |
서버 시행착오 (0) | 2020.07.30 |