로그인


https://koreanvlog.com/oracle/208 조회 수 589 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

위로 아래로 댓글로 가기 첨부
?

단축키

Prev이전 문서

Next다음 문서

위로 아래로 댓글로 가기 첨부

1. 도메인 DNS 설정

도메인을 구매하신 곳에서 DNS 설정에 들어갑니다.

 

아직 도메인이 없으신 분들은 아래 URL에서 무료로 만드실 수 있습니다.

https://www.freenom.com/

 

 

Name, Type, TTL, Taget 위와 동일하게 설정해줍니다.

설정방법은 도메인 구매처별로 상이합니다.

 

 

2. Nginx 라우팅 설정

EditPlus로 /etc/nginx/sites-available/default 열기 합니다.

 

# Default server configuration
server {
listen 80 default_server;
listen [::]:80 default_server;
 
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
 
server_name 도메인.com;
 
location / {
try_files $uri $uri/ =404;
 if (!-e $request_filename) { 
         rewrite ^.*$ /index.php last;
         }
}

 

server_name 옆에 도메인 주소를 입력합니다.

끝에 ; 을 잊지마세요.

try_files $uri $uri/ =404; 아래

if (!-e $request_filename) { 
         rewrite ^.*$ /index.php last;
         }

입력 합니다.

 

location ~ /\.ht {
    deny all;
}
}
 
### HTTP (CNAME 연결 www.도메인.com to 도메인.com ) ###
server {
    listen 80;
    listen [::]:80; 
    server_name www.도메인.com;
 
    location / { 
        return 301 http://도메인.com$request_uri;     ### http://도메인.com 로 리다이렉팅 
    }
}

 

location ~ /\.ht {
    deny all;
 }
}

하단부에 

 

### HTTP (CNAME 연결 www.도메인.com to 도메인.com ) ###
server {
    listen 80;
    listen [::]:80; 
    server_name 
www.도메인.com;

    location / { 
        return 301 
http://도메인.com$request_uri;     ### http://도메인.com 로 리다이렉팅 
    }
}

입력을 합니다.

 

# Default server configuration
server {
listen 80 default_server;
listen [::]:80 default_server;
 
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
 
server_name 도메인.com;
 
location / {
try_files $uri $uri/ =404;
 if (!-e $request_filename) { 
         rewrite ^.*$ /index.php last;
         }
}
 
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
include fastcgi_params;
fastcgi_read_timeout 300;
}
 
location ~ /\.ht {
    deny all;
}
}
 
### HTTP (CNAME 연결 www.도메인.com to 도메인.com ) ###
 server {
    listen 80;
    listen [::]:80; 
    server_name www.도메인.com;
 
    location / { 
        return 301 http://도메인.com$request_uri;     ### http://도메인.com 로 리다이렉팅 
    }
}

 

주석(#)을 빼고 전체코드를 보면 이렇습니다.

 

sudo nginx -t

 

아래 메시지가 나오면 Nginx가 정상적으로 작동하는 것입니다.

 

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

 

 

sudo service nginx restart

 

Nginx를 재시작 합니다.

 

 

?

전체 게시글

전체 게시글을 한번에 볼 수 있습니다.

  1. Read More
  2. Read More
  3. Read More
  4. Read More
  5. Read More
  6. Read More
  7. Read More
  8. No Image

    스크롤 시 고정되어 따라오는 배너 (고정형)

    짹니 2022.02.16 댓글0 조회수219
    Read More
  9. Read More
  10. Read More
  11. Read More
  12. Read More
  13. Read More
  14. Read More
  15. 10. 라이믹스(Rhymix) 설치하기

    짹니 2021.09.12 댓글0 조회수577 file
    Read More
  16. No Image

    9. DB 생성하기

    짹니 2021.09.12 댓글0 조회수407
    Read More
  17. Read More
  18. No Image

    7. Sendmail 설치하기

    짹니 2021.09.12 댓글0 조회수450
    Read More
  19. 6. 도메인 연결 및 Nginx 라우팅 설정

    짹니 2021.09.07 댓글0 조회수589 file
    Read More
  20. 5. MariaDB 및 phpMyAdmin 설치하기

    짹니 2021.09.07 댓글0 조회수570 file
    Read More
Board Pagination Prev 1 2 Next
/ 2