| 제목 | AWS 에서 WEB(NGINX)과 WAS(PHP-FPM)로 분리를 하려고 합니다 | ||
|---|---|---|---|
| 카테고리 | 서버 | ||
| 글쓴이 | 바보돌쇠 | 작성시각 | 2018/06/25 09:29:01 |
|
|
|||
|
안녕하세요. 오랜만에 질문을 남기게 되네요
이번에 프로젝트를 진행을 하면서 AWS를 사용을 하는데, WEB과 WAS로 서버를 분리를 하려고 합니다 그 동안에는 한 서버에서 NGINX와 PHP-FPM을 연동해서 사용을 하는데, 문제가 없었는데,
서버를 분리를 하려고 하니, 자료도 못찾겠고, 이렇게 저렇게 해봐도 제 능력으로는 답이 없어서 혹시나 먼저 경험을 해보신 분이 계신지 해서 문의 합니다. 각, 서버의 설정은 아래와 같습니다.
[ WEB 서버의 nginx.conf]
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
index index.html index.htm;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
root /var/xxxxx/public_html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
index index.html index.htm;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root internal-lmapps-stg-int-elb-xxxxx.amazonaws.com/var/xxxxx/public_html;
fastcgi_pass
internal-lmmapps-stg-int-elb-xxxxx.amazonaws.com:8080;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /sw/apps/public_html$fastcgi_script_name;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
[ WAS 서버의 php-fpm > www.conf] [www] user = apache group = apache listen = 8080 listen.owner = nobody listen.group = nobody listen.mode = 666 listen.allowed_clients = 127.0.0.1 pm = dynamic pm.max_children = 50 pm.start_servers = 5 pm.min_spare_servers = 5 pm.max_spare_servers = 35 slowlog = /var/log/php-fpm/www-slow.log chroot = /var/xxxxx/public_html ;chidr = /var/www security.limit_extensions = .php .php3 .php4 .php5 .php7 php_admin_value[error_log] = /var/log/php-fpm/7.1/www-error.log php_admin_flag[log_errors] = on php_value[session.save_handler] = files php_value[session_save_path] = /var/lib/php/7.1/session php_value[soap.wsdl_cache_dir] = /var/lib/php/7.1/wsdlcache
|
|||
| 다음글 | 안녕하세요. post값 이 제대로 전송이되지않아 질문... (3) | ||
| 이전글 | DB를 Hadoop으로 사용한 분이 있나요? (2) | ||
|
변종원(웅파)
/
2018/06/25 16:47:31 /
추천
0
|
|
바보돌쇠
/
2018/06/25 17:01:10 /
추천
0
답변 감사합니다.
|
양쪽 설정에서 아이피나 도메인 부분만 수정하시면 됩니다.
하나의 서버에서 로컬을 보고 있었던 것을 아이피나 도메인으로 변경해주면 되구요. 포트를 따로 사용하면 aws 보안설정에서 그 포트를 열어주시면 됩니다.
어차피 2대의 서버 새로 셋팅해서 테스트중이실테니까 해보시면서 막히시는 부분 물어보시는게 빠를겁니다.