nginx를 CentOS 7에 설치하고 난 후, 한국에서만 접속을 허용하도록 하기 위해서는 다음과 같은 방법으로 할 수 있다.

1. GeoIP 설치
yum install -y geoip #install location : /usr/share/GeoIP/
2. nginx module dynamic 설치
yum install -y nginx-module-geoip #install location : /etc/nginx/modules/
3. nginx 설정 변경
vi /etc/nginx/nginx.conf
#nginx 설정 파일의 맨 위에 다음 2줄 추가
load_module modules/ngx_http_geoip_module.so;
load_module modules/ngx_stream_geoip_module.so;
http {
......
# 아래 설정 추가
# geoip national data file location
geoip_country /usr/share/GeoIP/GeoIP.dat;
# geoip national code mapping, default no, korea yes
map $geoip_country_code $allowed_country {
    default no;
    KR yes;
}
 #log_format에 국가코드 출력
log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    '$status $body_bytes_sent $proxy_host $upstream_addr "$http_referer" '
    '"$http_user_agent" "$http_x_forwarded_for" "$geoip_country_code"';
4. nginx 설정 syntax check
nginx -t
5. nginx 재기동
service nginx restart
service nginx status



받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://www.yongbi.net/rss/response/868

VirtualBox에 CentOS 7을 Minimal로 설치했을 경우,
curl www.naver.com과 같이 외부 URL을 호출하거나,
yum update를 실행했을 경우 다음과 같은 오류가 발생한다.
Could not resolve host ...
Network 카드 설정이 제대로 되어 있지 않을 때 발생하는 오류이다.
다음 command로 Ethernet 설정을 확인할 수 있다.
[root@localhost user]# ip addr

다음과 같이 설정을 변경할 수 있다.
[root@localhost user]# vi /etc/systemconfig/network-scripts/ifcfg-<ethernet card name>
ONBOOT=yes # 맨 아래 항목 no -> yes로 수정 후 저장
다음 command로 DHCP IP를 재할당받으면 된다.
[root@localhost user]# dhclient

TAG
받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://www.yongbi.net/rss/response/867

Telnet Client가 설치되어 있지 않은 경우, 먼저 telnet 설치
yum -y install telnet
방화벽이 열려 있지 않은 경우
telnet ip_address port_number
---> Connection timed out
방화벽은 열려 있으나, 해당 포트 서비스가 안 떠 있는 경우
telnet ip_address port_number
---> Connection refused
방화벽도 열려 있고, 서비스도 떠 있는 경우
telnet ip_address port_number
---> Connected to ip_address
---> Escape character is '^]'.

받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://www.yongbi.net/rss/response/851

1. PostgreSQL Installation by using yum
yum install -y postgresql9.6*
2. Initialize Database
/usr/pgsql-9.6/bin/postgresql96-setup initdb
3. Service Registry on System Boot
systemctl start postgresql-9.6
systemctl enable postgresql-9.6
4. Edit Configurations
vi /var/lib/pgsql/9.6/data/pg_hba.conf
    host    all             all              127.0.0.1/0               md5
    host    all             user                       0.0.0.0/0                  md5
vi /var/lib/pgsql/9.6/data/postgresql.conf
   listen_address = '*'
5. Service Restart
systemctl restart postgresql-9.6

받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://www.yongbi.net/rss/response/848

CentOS 7.4 SFTP 설정

Articles 2019/06/17 20:37 용비
1. sftp user creation
  • create the user
sudo adduser access
  • assign a password to the new user
sudo passwd access

2. Create Directory for File Transfer
  • create the directory for file upload
sudo mkdir -p /var/sftp/uploads
  • establish the root user as owner
sudo chown root:root /var/sftp
  • grant write permissions to the root user and read to the other users
sudo chmod 755 /var/sftp
  • modify the owner of uploads to be the user access
sudo chown access:access /var/sftp/uploads

3. Restrict Directory Access
  • restrict the access by the terminal to the user access
sudo vi /etc/ssh/sshd_config
  • In the final part of the file, add followings
Match User access

ForceCommand internal-sftp
PasswordAuthentication yes
ChrootDirectory /var/sftp
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no
  • Save the changes using the key combination
ESC + :wq
  • apply the changes in SSH
sudo systemctl restart sshd

4. Verify SSH Connection
  • SSH connection
ssh acces@{server_ip}
         ==> The result is verified that the connection will be closed through SSH
  • Use the sftp protocol
sftp access@{server_ip}










받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://www.yongbi.net/rss/response/847