vuejs 를 사용시 vue-router 를 사용하여, 경로를 지정할 수 있다.
그러면 about / price / 등 필요한 페이지를 분리할 수 있어 작업하기 편하다.
그런데, SPA 웹페이지이기 때문에 index.html 내에서 처리가 된다.

즉, 해당 경로로 직접 들어가면 404 페이지가 표시된다.
그렇다면 404 페이지를 모두 index.html 으로 보내면 된다. ( 참조 : https://router.vuejs.org/kr/guide/essentials/history-mode.html )

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.html [L]
</IfModule>

아파치 apache 설정시 다음과 같은 에러가 발생할 수 있다.

RewriteBase: only valid in per-directory config files
Action 'configtest' failed.
The Apache error log may have more information.

그런경우는 해당 설정이 <Directory > </Directory> 설정내에 넣어준다.

<Directory {{vue앱-디렉토리패스}}>

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.html [L]
</IfModule>

</Directory>

이런식으로 넣어준다. vue 앱과 서버측 (node / go / php 등) 어플과 조합을 해서 사용가능하다.

php 같은 경우 laravel 등의 프레임웍(modern php)을 써도 되고, 그냥 날코딩(legacy php)으로 만들어서 조합해도 상관없다.

{{vue-app-path}}/api/[php app file].php

형태로 php 어플을 실행해도 된다.

반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,
centos 에서 아파치모듈을 컴파일 하는데, 다음과 같은 에러가 난다.
cannot open /httpd/build/config_vars.mk: 그런 파일이나 디렉토리가 없음 at /usr/sbin/apxs line 201.
apxs 는 perl 로 작성되어 있다. 코드를 보다보니.
pkg-config --variable=libdir apr-1
이 부분에서 아무 리턴값이 없는 것이다. (정상은 /usr/lib64 로 나와야 한다)

yum list apr*
으로 확인해보니,  apr-devel  이 i386 버전으로 설치되어 있고, x64 용으로는 설치가 되어 있지 않았다.
그래서
yum install apr-devel
으로 x64 버전도 설치했다.

apxs -ic mod_url.c
apxs -ic mod_bw.c
모두 정상적으로 컴파일 된다.

반응형

WRITTEN BY
1day1
하루하루 즐거운일 하나씩, 행복한일 하나씩 만들어 가요.

,