프로그램 사용/apache2019. 2. 27. 12:54

virtualhost 라는 기능으로 구현이 가능한데..

웹 서버에서 하는건가? haproxy나 squid로 안되는걸려나? ㅠㅠ


[링크 : https://mynewparadigm.tistory.com/entry/1개의-ip로-2개의-도메인을-연결하는-방법]

[링크 : https://blog.readiz.com/29]

[링크 : https://hudi.kr/node-js-node-js-에서-vhost-사용/]


+

기본적으로 이 기능은 L4 에서 작동하는 것으로

apache / nginx / node.js 등에서 설정이 가능하다.

[링크 : https://stackoverflow.com/...-host-multiple-node-js-sites-on-the-same-ip-server-with-different-domain]

[링크 : https://www.joinc.co.kr/w/man/12/Nginx/virtualhost]

[링크 : https://gist.github.com/jakebellacera/590803]

[링크 : https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/]

'프로그램 사용 > apache' 카테고리의 다른 글

mod_rewrite 테스트..  (4) 2017.04.12
mod_rewrite 로그설정  (0) 2017.04.12
라즈베리 파이 mod_rewrite 활성화  (0) 2017.04.11
mod_rewrite 설정 및 정규표현식  (0) 2017.04.10
apache mod_deflast mod_gzip  (0) 2017.01.23
Posted by 구차니
프로그램 사용/apache2017. 4. 12. 09:43

에러로그 설정하고 보는데 먼소리인지 모르겠다 ㅠㅠ

일단 규칙은 아래와 같이 들어온 주소를 index.php?url="어쩌구" 식으로 바꾸어 주는건데

문제는 ^(.+)$ ...

처음부터 끝까지 내용이 없던 머던 상관없는데 이걸 $1로 치환하라 인데

Options -MultiViews

RewriteEngine On

Options -Indexes

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)$ index.php?url=$1 [QSA,L] 


현재 읽혀 있는 경로에서 달라지는 내용만을 적용대상으로 삼는건가?

/var/www/html/arch/test/index.php 에서 있는 파일은 웹상으로 접속하면

http://localhost/arch/test 인데, 이 파일에서 링크된 다른 경로

arch/test/board는 이전 주소를 기본으로 볼때 board가 하나 추가 된 셈이니

test 이후의 board만 들어가서 rewrite rule에 적용을 받는건가?

 [perdir /var/www/html/arch/test/] add path info postfix: /var/www/html/arch/test/board -> /var/www/html/arch/test/board/, referer: http://localhost/arch/test/board/

 [perdir /var/www/html/arch/test/] strip per-dir prefix: /var/www/html/arch/test/board/ -> board/, referer: http://localhost/arch/test/board/

 [perdir /var/www/html/arch/test/] applying pattern '^(.+)$' to uri 'board/', referer: http://localhost/arch/test/board/

 [perdir /var/www/html/arch/test/] rewrite 'board/' -> 'index.php?url=board/', referer: http://localhost/arch/test/board/

 split uri=index.php?url=board/ -> uri=index.php, args=url=board/, referer: http://localhost/arch/test/board/

 [perdir /var/www/html/arch/test/] add per-dir prefix: index.php -> /var/www/html/arch/test/index.php, referer: http://localhost/arch/test/board/

 [perdir /var/www/html/arch/test/] strip document_root prefix: /var/www/html/arch/test/index.php -> /arch/test/index.php, referer: http://localhost/arch/test/board/

 [perdir /var/www/html/arch/test/] internal redirect with /arch/test/index.php [INTERNAL REDIRECT], referer: http://localhost/arch/test/board/

 [perdir /var/www/html/arch/test/] strip per-dir prefix: /var/www/html/arch/test/index.php -> index.php, referer: http://localhost/arch/test/board/

 [perdir /var/www/html/arch/test/] applying pattern '^(.+)$' to uri 'index.php', referer: http://localhost/arch/test/board/

 [perdir /var/www/html/arch/test/] pass through /var/www/html/arch/test/index.php, referer: http://localhost/arch/test/board/

 [perdir /var/www/html/arch/test/] strip per-dir prefix: /var/www/html/arch/test/public/css/style.css -> public/css/style.css, referer: http://localhost/arch/test/board/

 [perdir /var/www/html/arch/test/] applying pattern '^(.+)$' to uri 'public/css/style.css', referer: http://localhost/arch/test/board/

 [perdir /var/www/html/arch/test/] pass through /var/www/html/arch/test/public/css/style.css, referer: http://localhost/arch/test/board/ 


[링크 : http://webskills.kr/archives/515]


+

QSA는 Cond를 지난 결과에 덧 붙인다라는 의미..

음.. 경로의 마법은 저 Cond와 QSA인가?

[링크 : http://soul0.tistory.com/208]


+

REQUEST_FILENAME

The full local filesystem path to the file or script matching the request, if this has already been determined by the server at the time REQUEST_FILENAME is referenced. Otherwise, such as when used in virtual host context, the same value as REQUEST_URI. Depending on the value of AcceptPathInfo, the server may have only used some leading components of the REQUEST_URI to map the request to a file.


REQUEST_URI

The path component of the requested URI, such as "/index.html". This notably excludes the query string which is available as its own variable named QUERY_STRING.

[링크 : http://httpd.apache.org/docs/current/mod/mod_rewrite.html]


Filename should give you the complete local path, where request uri will be exactly what was requested (should also include the GET parameters). From the manual:

REQUEST_URI

The resource requested in the HTTP request line. (In the example above, this would be "/index.html".)

REQUEST_FILENAME

The full local filesystem path to the file or script matching the request. 

[링크 : http://www.miva.com/...-htaccess-what-s-the-difference-between-request_filename-and-request_uri]

Posted by 구차니
프로그램 사용/apache2017. 4. 12. 09:30

테스트를 해보니.. apache 전역 환경설정에서 해야 하고

로컬 .htaccess에 설정하면 에러가 발생한다.

[Wed Apr 12 09:14:03.530865 2017] [core:alert] [pid 30981] [client 0.0.0.0:3628] /var/www/html/arch/test/.htaccess: LogLevel not allowed here 


아파치 2.4 이후

LogLevel alert rewrite:trace3

[링크 : http://httpd.apache.org/docs/current/mod/mod_rewrite.html]


아파치 2.2 이전

RewriteEngine on

RewriteLog /path/to/log

RewriteLogLevel 5 

[링크 : https://wiki.apache.org/httpd/RewriteLog]



그나저나 한 페이지 로딩할때 이미지나 css 등 개별파일들 전부 적용되서 로그가 남는구나 ㄷㄷ

Posted by 구차니
프로그램 사용/apache2017. 4. 11. 19:54

기본값으로는 해당 모듈이 활성화 되어 있지 않았네...


$ cd /etc/apache2/mods-enabled

$ sudo ln -s ../mods-available/rewrite.load rewrite.load 




+

Directory 항목중 AllowOverride all 를 해주지 않으면

파일로 저장된 .htaccess를 적용되지 않는 것으로 보인다.

[링크 : http://zetawiki.com/wiki/하위폴더_.htaccess_설정]

'프로그램 사용 > apache' 카테고리의 다른 글

mod_rewrite 테스트..  (4) 2017.04.12
mod_rewrite 로그설정  (0) 2017.04.12
mod_rewrite 설정 및 정규표현식  (0) 2017.04.10
apache mod_deflast mod_gzip  (0) 2017.01.23
무료 ssl 인증서 - lets encrypt  (2) 2017.01.20
Posted by 구차니
프로그램 사용/apache2017. 4. 10. 15:31
프로그램 사용/apache2017. 1. 23. 15:13

라즈베리에서 아파치 돌리는데 기본으로 mod_deflate가 활성화 되어 있는 것으로 보이네..

[링크 : http://extrememanual.net/4252]


아래는 제대로 압축을 수행중인지 확인하는 링크

gzip 확인은 실패하네.. 머지?

[링크 : http://tecadmin.net/how-to-enable-gzip-compression-on-apache/]

    [링크 : https://checkgzipcompression.com/]

    [링크 : http://www.whatsmyip.org/http-compression-test/]


+

ssl 적용해놨지만 인증서가 사설이라 --no-check-certificate를 해줘야 받아온다. ㅠㅠ

아무튼 받아온걸 file로 확인해보면 압축된 녀석 흐음..

$ wget --no-check-certificate --header="Accept-Encoding: gzip" https://localhost/php_test/phpinfo.php

--2017-01-23 15:40:12--  https://localhost/php_test/phpinfo.php

Resolving localhost (localhost)... ::1, 127.0.0.1

Connecting to localhost (localhost)|::1|:443... connected.

WARNING: The certificate of ‘localhost’ is not trusted.

WARNING: The certificate of ‘localhost’ hasn't got a known issuer.

The certificate's owner does not match hostname ‘localhost’

HTTP request sent, awaiting response... 200 OK

Length: 24808 (24K) [text/html]

Saving to: ‘phpinfo.php’


phpinfo.php                  100%[===============================================>]  24.23K  --.-KB/s   in 0.007s


2017-01-23 15:40:12 (3.63 MB/s) - ‘phpinfo.php’ saved [24808/24808] 


$ file phpinfo.php

phpinfo.php: gzip compressed data, from Unix


[링크 : https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-mod_deflate-on-ubuntu-14-04]

[링크 : https://forum.ivorde.com/wget-error-error-the-certificate-of-is-not-trusted-t19611.html]


+

표준상으로는 compress, gzip 정도 밖에 안되는건가?

[링크 : https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html]

Posted by 구차니
프로그램 사용/apache2017. 1. 20. 21:07

90일간 유효하지만 cron으로 자동으로 업데이트 하도록 하는 것 까지 다 되어있나 보네?

[링크 : https://certbot.eff.org/#ubuntuxenial-apache]


[링크 : http://kr.minibrary.com/353/]

[링크 : https://blog.outsider.ne.kr/1178]

[링크 : https://letsencrypt.org/]



+

2017.01.23

엥? 라즈베리에는 안되나?

$ sudo apt-cache search letsencrypt

$ sudo apt-get install python-letsencrypt-apache

Reading package lists... Done

Building dependency tree

Reading state information... Done

E: Unable to locate package python-letsencrypt-apache 

[링크 : https://launchpad.net/ubuntu/+source/python-letsencrypt-apache]

[링크 : http://askubuntu.com/questions/445487/which-ubuntu-version-is-equivalent-to-debian-squeeze]


정리 하자면.. 라즈베리에서 쓰는 jessie는 debian쪽인데

14.04 ~ 15.10 정도에 대응하는 버전이라고 한다. 그러니까 없지 ㅠㅠ

Posted by 구차니
프로그램 사용/apache2017. 1. 20. 20:19

기사를 보다보니 나라에서 발급해주는데가 있네?


[링크 : http://v.media.daum.net/v/20170120142600405]

[링크 : https://www.gpki.go.kr/]



아.. 빌어먹을 한글파일 -_-


네이버 클라우드 사용하면 머 보고 쓸순 있으니..

그냥 이걸로 공문 만들어서 하면 되는건가?


와.. 사이트에서 해주는 것도 아니고 인증담당자 검색도 안되는거 페이지 넘겨가면서 찾고는

전화해서 해주세요 굽신굽신 해야 하는거야?!?!


그런데 개인용이라길래 나 같이 정말 "개인"이 쓰는건줄 알았는데...

그 개인이 그 개인이 아냐?!


개인

인증관리센터는 행정기관 소속 공무원이 사용자인증 및 전자결재, 보안메일 등의 행정업무 또는 전자상거래 등에서 활용하도록 하기 위해 부처별 개인단위로 인증서를 발급합니다.

[링크 : https://gcert.gpki.go.kr/jsp/certInfo/certIntro/certKind/searchCertkind.jsp]

[링크 : https://parking.suwon.go.kr/uat/uia/egovGpkiIssu.do]

Posted by 구차니
프로그램 사용/apache2017. 1. 10. 13:55

mod_throttle은 대충 찾아 보니 Apache 1.x 꺼고

mod_cband는 apache 2.x 용인듯


그래서 대세(!?)는 mod_cband


[링크 : https://sourceforge.net/projects/cband/]

[링크 : http://serverfault.com/questions/30149/alternative-to-mod-throttle]

Posted by 구차니

여기 문서를 참고해서 일단

가입 - 인증서 설치 - 로그인 - domain 인증 - 사이트 인증서 발급 함

[링크 : https://www.xetown.com/slope/135905]


발급과정에서 개인키 생성해서 웹에붙여 주어야 하는데 yourname.csr을 사용하고

개인키에 암호를 삭제한 yourname.nokey 파일을 생성

$ openssl req -newkey rsa:2048 -keyout yourname.key -out yourname.csr

Generating a 2048 bit RSA private key

.+++

.....................+++

writing new private key to 'yourname.key'

Enter PEM pass phrase:

Verifying - Enter PEM pass phrase:

-----

You are about to be asked to enter information that will be incorporated

into your certificate request.

What you are about to enter is what is called a Distinguished Name or a DN.

There are quite a few fields but you can leave some blank

For some fields there will be a default value,

If you enter '.', the field will be left blank.

-----

Country Name (2 letter code) [AU]:KR

State or Province Name (full name) [Some-State]:

Locality Name (eg, city) []:

Organization Name (eg, company) [Internet Widgits Pty Ltd]:

Organizational Unit Name (eg, section) []:

Common Name (e.g. server FQDN or YOUR name) []:

Email Address []:


Please enter the following 'extra' attributes

to be sent with your certificate request

A challenge password []:

An optional company name []:


그리고는 키를 없애고 키 저장소로 복사!

$ openssl rsa -in yourname.key -out yourname.nokey

Enter pass phrase for yourname.key:

writing RSA key

$ sudo cp yourname.nokey /etc/ssl/private/yourname.nokey 

[링크 : http://blog.acu.pe.kr/55]


그러면 zip파일로 다운받을 수 있는데

apache를 쓰고 있으니 해당 파일을 압축 풀어 /etc/ssl/certs 에 넣어 주었다.

$ unzip minimonk.net.zip

$ unzip ApacheServer.zip

$ sudo cp *.crt /etc/ssl/certs


일단 공식사이트에서는 이렇게 하라는데

SSLCertificateFile "/usr/local/apache2/conf/2_your_domain.crt"

SSLCertificateKeyFile "/usr/local/apache2/conf/private.key"

SSLCertificateChainFile "/usr/local/apache2/conf/1_root_bundle.crt" 

[링크 : https://www.startssl.com/Support?v=21]


나의 경우에는 이런식으로 설정

$ sudo vi /etc/apache2/sites-available/default-ssl.conf 

                SSLCertificateFile /etc/ssl/certs/2_your_domain.crt

                SSLCertificateKeyFile /etc/ssl/private/yourname.nokey

                SSLCertificateChainFile /etc/ssl/certs/1_root_bundle.crt


아무튼 라즈베리 키로 할때는 안전하지 않음이라고 크롬에서 뜨는데

starssl 에서 적용하니 이제 안전함! 우오오옹

class 1이라 그런가

은행권 처럼 녹색으로 줄이 쫙! 그이진 않네


---

처음 하라는대로 해보니 되긴한데 암호 넣으라고 한다. ㅠㅠ

그래서 키삭제 하는게 서비스 유지에는 편리!

$ sudo service apache2 restart

Enter passphrase for SSL/TLS keys for 127.0.1.1:443 (RSA): ******** 



어? 아이패드에서 (ios 10.2) 접속 자체를 안하는것 같다?!?!
[링크 : https://discussions.apple.com/thread/7791706?start=0&tstart=0]


Posted by 구차니