Zero To One

정적 웹 콘텐츠 호스팅 및 빌드해보기 본문

카테고리 없음

정적 웹 콘텐츠 호스팅 및 빌드해보기

Zero_To_One 2022. 2. 26. 00:03

1. nginx 설치

 

2.

cd /etc/nginx/conf.d

3. default.conf 파일이 있을 것이다. cat으로 열어보자

 

4. 나같은 경우 10024번으로 포트가 되어있다.

> cat default.conf
server {
    listen       10024;
    server_name  localhost;

    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /home/jaehyeok/sprint-cozstory-frontend/build;
        index  index.html;
    }

    #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   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    #location ~ \.php$ {
    #    root           html;
    #    fastcgi_pass   127.0.0.1:9000;
    #    fastcgi_index  index.php;
    #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    #    include        fastcgi_params;
    #}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

5. http://localhost:port번호/ 으로 접속하자. port번호는 위에서 listen으로 확인할 수 있다.

 

6. 샘플 페이지가 나오면 성공

 

7. 빌드 하기

   1) react 설치

   2) 원하는 파일에 들어가서 npm start

   3) npm run build

 

8. 빌드를 성공적으로 완료했다면 폴더에 빌드 폴더가 나타나고 빌드가 성공적으로 되었다는 뜻이다.