일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- speed-measure-webpack-plugin
- intelmac
- 채팅환전사기
- 허리디스크
- 로맨스스캠
- ue4dumper
- Frida
- Sequoia
- XSS
- 중고나라
- ssrf
- 거래사기
- react
- 많다..
- MongoDB #NoSQL #CreateUser #DropUser #mongod #mognod.conf
- 네이버카페
- 보이스피싱 #대검찰청 #명의도용 #비밀번호 #계좌번호 #공공기관 #가짜검찰청
- NUGU
- 취약점
- shell_gpt
- CJ대한통운 #쿠팡 #통관번호오류 #통관고유번호오류 #안주원팀장 #모건인베스트
- Malware Sample
- open redirect
- self-signed
- 모의해킹
- 안전결제
- CryptoJS
- 척추관협착증
- esbuild
- 변태는
- Today
- Total
annyoung
Mac apache 2.4.34 VirtualHost, ProxyPass 적용하기 본문
nopsled@Sangui-MacBookPro:/etc/apache2 (=`ω´=)$ apachectl -V Server version: Apache/2.4.34 (Unix) Server built: Aug 17 2018 18:35:43 Server's Module Magic Number: 20120211:79 Server loaded: APR 1.5.2, APR-UTIL 1.5.4 Compiled using: APR 1.5.2, APR-UTIL 1.5.4 Architecture: 64-bit Server MPM: prefork threaded: no forked: yes (variable process count) Server compiled with.... -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_FLOCK_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=256 -D HTTPD_ROOT="/usr" -D SUEXEC_BIN="/usr/bin/suexec" -D DEFAULT_PIDLOG="/private/var/run/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="/private/etc/apache2/mime.types" -D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf" |
nopsled@Sangui-MacBookPro:/etc/apache2 (=`ω´=)$ tree . . ├── extra │ ├── httpd-autoindex.conf │ ├── httpd-dav.conf │ ├── httpd-default.conf │ ├── httpd-info.conf │ ├── httpd-languages.conf │ ├── httpd-manual.conf │ ├── httpd-mpm.conf │ ├── httpd-multilang-errordoc.conf │ ├── httpd-ssl.conf │ ├── httpd-userdir.conf │ ├── httpd-vhosts.conf │ └── proxy-html.conf ├── httpd.conf ├── httpd.conf.pre-update ├── magic ├── mime.types ├── original │ ├── extra │ │ ├── httpd-autoindex.conf │ │ ├── httpd-dav.conf │ │ ├── httpd-default.conf │ │ ├── httpd-info.conf │ │ ├── httpd-languages.conf │ │ ├── httpd-manual.conf │ │ ├── httpd-mpm.conf │ │ ├── httpd-multilang-errordoc.conf │ │ ├── httpd-ssl.conf │ │ ├── httpd-userdir.conf │ │ ├── httpd-vhosts.conf │ │ └── proxy-html.conf │ └── httpd.conf ├── other │ └── php7.conf └── users └── Guest.conf 5 directories, 31 files nopsled@Sangui-MacBookPro:/etc/apache2 (=`ω´=)$ |
Python flask wsgi 적용하기 귀찮아서 위처럼 사용하고 있다... (이러면 안되는거 알지만.......)
아무튼 Apache 2.4.34, Apache 디렉토리에 뭐가 있는지 확인했는데 똑같으면 아래와 같이 따라하면 된다.
LoadModule proxy_html_module libexec/apache2/mod_proxy_html.so LoadModule proxy_module libexec/apache2/mod_proxy.so LoadModule proxy_http_module libexec/apache2/mod_proxy_http.so # proxy module 주석을 제거 해준다. DocumentRoot "/var/www/default" <Directory "/var/www/default"> Options FollowSymLinks Multiviews Indexes MultiviewsMatch Any AllowOverride all Require all granted Allow from all </Directory> # DocumentRoot의 default 위치 지정 (기본적으로 127.0.0.1, localhost라고 생각하면 됨) Include /private/etc/apache2/extra/httpd-vhosts.conf # httpd-vhosts.conf 파일을 include 시켜준다. |
sudo vi /etc/apache2/httpd.conf
sudo로 httpd.conf 파일을 열어서 위와 같이 수정 및 추가한다.
<VirtualHost scope.nopsled.local:80> ServerAdmin scope@admin.scope.com # 아무거나 써도 된다 ServerName scope.nopsledlocal # 아무거나 써도 된다 ServerAlias scope.nopsled.local # 아무거나 써도 된다 DocumentRoot "/var/www/scope" # DocumentRoot 지정 ErrorLog "/private/var/log/apache2/scope-error.log" CustomLog "/private/var/log/apache2/scope-access.log" common <Directory /var/www/scope> # 여기서도 DocumentRoot 지정 Allow from all AllowOverride All Require all granted Options Indexes FollowSymLinks MultiViews </Directory> <IfModule mod_rewrite.c> # mod_rewrite.c Module이 있는 경우 아래 실행 RewriteEngine On # RewriteEngine 키고 ProxyPass / http://127.0.0.1:8080/ # /로 들어온 모든 사용자는 127.0.0.1:8080를 프록시로 사용 ProxyPreserveHost On ProxyErrorOverride Off # Error는 override하지 않는다 </IfModule> </VirtualHost> <VirtualHost 127.0.0.1:80 localhost:80> # 위 도메인 외에 127.0.0.1:80, localhost:80에 접속하는 사용자는 아래와 같이 포워딩한다 ServerAdmin nopsled@localhost ServerName nopsled.localhost DocumentRoot "/var/www/default" ErrorLog "/private/var/log/apache2/default-error.log" CustomLog "/private/var/log/apache2/default-access.log" common <Directory /var/www/default> Allow from all Require all granted AllowOverride all </Directory> </VirtualHost> |
sudo vi /etc/apache2/extra/httpd-vhosts.conf
httpd-vhosts.conf를 sudo로 열어서 위와 같이 수정해준다.
## # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. ## 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost 127.0.0.1 scope.nopsled.local |
sudo vi /etc/hosts
hosts를 열어서 위와 같이 마지막에 추가해준다.
이제 열어보면 잘된다. 이렇게 했는데도 안되면 /var/log/apache2/에 있는 error.log를 참고하면서 trouble shooting하면 된다.
'운영체제' 카테고리의 다른 글
aws ec2 ssh 비밀번호 설정 (22) | 2024.08.02 |
---|---|
define npm global path on mac (2) | 2019.07.07 |
/etc/sudoers 권한 변경 실패시 (4) | 2018.12.10 |
linux UTC to KST (also hardware time too) (0) | 2018.06.05 |
crontab checker (0) | 2018.04.26 |