반응형

vue.js 4

[Vue.js & nginx] 정적 Vue 프로젝트를 nginx에서 돌릴 때 발생하는 404 에러 해결 방법 / Vue nginx 설정

nginx 설정 location / { try_files $uri $uri/ /index.html; } 기본은 위와 같이 설정되어 있을 것인데, 이를 아래와 같이 바꿔주면 된다. location / { try_files $uri $uri/ @rewrite; } location @rewrite { rewrite ^(.+)$ /index.html last; } try_files의 의미만 느끼는 대로 이해한다면, 본 코드는 어렵지 않게 이해하리라 믿습니다.

개발/Vue.js 2021.08.23

[Nginx / Lightsail] POST 405 not allowed 해결 방법 - Vue.js Axios PHP PDO Post

Lightsail에 국한된 에러는 아니고, Nginx로 PDO(PHP Data Object)에 POST를 요청할 때 만날 수 있는 에러이다. 리눅스 기준으로 /etc/nginx/conf.d/default.conf 파일을 보면, server { root index server_name location / { ... } location ~ \.php$ { fastcgi_pass php-handler; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_read_timeout 300; } . . . } 두 번째 location ~ \.php$ { ... } 을 추가해주면 된다. CORS ..

개발 2021.06.18

[Vue.js] Axios로 Post 하는 방법

우선 axios가 사용 되는 소스 코드의 위치는 다음과 같다. src/store/index.js import axios from "axios"; export default new Vuex.Store({ state: {}, mutations: {}, actions: { functionName({commit}, payload) { return new Promise((resolve, reject) => { var params = new URLSearchParams(); params.append('var1', payload.var1); params.append('var2', payload.var2); params.append('var3', payload.var3); . . . axios .post(url, pa..

개발/Vue.js 2021.06.18
반응형