728x90
laravel 프로젝트를 nginx 로 연동한거에 이어 vue 프로젝트도 서버에 올려보자!
2020.06.11 - [LINUX] - ubuntu 18.04 + laravel + nginx 로 환경 설정하기
환경설정
먼저 ubuntu 업데이트 해주기
apt-get upgrade
apt-get update
해준다음 nginx 도 같이 설치해준다
apt-get install nginx
설치를 모두 마쳤으면 퍼블릭 ip주소로 들어가서 nginx 사이트가 잘 들어가지는지 확인한다!
이화면이 정상적으로 떠야 한다!
서버연동
현재 nginx 기본 페이지로 설정되어있는 nginx 파일을 새로 설정해주어야한다!
/etc/nginx/sites-available/default
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
#root /var/www/html;
root /var/www/<프로젝트명>/dist;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.html;
}
# pass PHP scripts to FastCGI server
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
여기서 특별하게 변경해야될 부분은 없지만 제일 중요한건 root쪽에 프로젝트 경로로 변경해주어야한다
"root /var/www/<프로젝트명>/dist"
그리고 꼭 build된 파일 index.html이 있는 경로일것!!
그러고 난뒤 service nginx restart로 nginx 를 껐다키면 설정완료!
728x90
'FRAMEWORK > VUE' 카테고리의 다른 글
vue infinite loading 활용하기 (0) | 2021.04.15 |
---|---|
VUE Window Resizing check (0) | 2021.02.22 |
[vuejs]regeneratorruntime is not defined vue async 에러 해결 (0) | 2021.01.19 |
[vue.js] ckeditor4 사용하기 (0) | 2021.01.13 |
open_now is deprecated as of November 2019. Use the isOpen() method from a PlacesService.getDetails() result instead. (0) | 2020.11.23 |