유돌이

calendar

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 29 30 31

Notice

2019. 9. 20. 09:49 유닉스*리눅스*SE

df : 남은용량 확인

df -k : 남은용량 확인 (KB)

df -m : 남은용량 확인 (MB) 

df -h : 남은용량 확인 (용량에 맞게 표현)

df . : 현재 디렉토리가 포함된 파티션의 남은용량 확인

 

du : 현제 디렉토리에서 서브디렉토리까지의 사용량 확인

du -a : 현재 디렉토리의 사용량을 파일단위 출력

du -s : 총 사용량을 확인

du -h : 보기좋게 표현!

du -sh * : 한단계 서브디렉토리 기준으로 출력

posted by 유돌이
2019. 9. 20. 09:49 유닉스*리눅스*SE

윈도우서버 IIS에서 apk 파일 다운로드 가능하도록 설정  

 

 

IIS의 mimetype 설정에서 아래의 확장자를 추가

.apk

application/vnd.android.package-archiv

posted by 유돌이
2019. 9. 20. 09:48 유닉스*리눅스*SE

NGINX + PHP-FPM에서 502 BAD GATEWAY 에러 해결방법

 

방법1. nginx.conf 수정

 location ~ \.php$ {
           # With php7-fpm:
           fastcgi_split_path_info ^(.+\.php)(/.+)$;
           fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
           fastcgi_index index.php;
           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 
          # 아래부터 버그 해결을 위해 추가해 주실 옵션입니다.
          # 502 에러를 없애기 위한 proxy 버퍼 관련 설정입니다.
          proxy_buffer_size               128k;
          proxy_buffers                   4 256k;
          proxy_busy_buffers_size         256k;
 
          # 502 에러를 없애기 위한 fastcgi 버퍼 관련 설정입니다.
          fastcgi_buffering               on;
          fastcgi_buffer_size             16k;
          fastcgi_buffers                 16 16k;
 
          # 최대 timeout 설정입니다.
          fastcgi_connect_timeout         600s;
          fastcgi_send_timeout            600s;
          fastcgi_read_timeout            600s;
 
          # 이 아래 설정은 PHP 성능 향상을 위한 옵션입니다. 추가해 주시면 좋습니다.
          sendfile                        on;
          tcp_nopush                      off;
          keepalive_requests              0;

 

방법 2.  nginx의 설정 파일과 php-fpm 설정 파일의 소켓 일치시키기

– 간혹 nginx의 설정 안에서의 ‘fastcgi-pass’ 경로와, php-fpm 설정 파일의 listen 경로가 다른 경우, 502 Bad gateway 에러가 나타나는 경우가 있다고도 합니다. 이런 경우에는 PHP를 불러오는 대다수의 경우의 에러가 발생하는 경우가 많습니다.

– 먼저 nginx 설정 파일에서 PHP를 처리하는 부분의, fastcgi-pass 값을 확인하여 PHP-fpm sock 파일이 정상적으로 위치해 있는지 확인합니다. (없는 경우에는, sock 파일을 찾아서 적당한 경로로 입력해 주어야 합니다. 많은 경우에는 /var/ 디렉토리 안에서 php 관련 폴더 안에 위치하고 있습니다.)

 

방법3.  php-fpm 설치 후 php-fpm을 실행하지 않은 경우

   php-fpm 실행   

 

posted by 유돌이
2019. 9. 20. 09:47 유닉스*리눅스*SE

리눅스 타임존 변경 (리눅스 시간변경)

 

1. 아래의 명령어로 링크된 타임존체크

=> ls -al /etc/localtime   

 

2. 원하는 지역에을 찾을수 있다.

=> cd /usr/share/zoneinfo/Asia/

 

3. 서울로 설정하고 싶다면..

=> ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime  (타임존 변경)

=> rdate -s time.bora.net   (시간동기화)

 

4. 강제로 시간을 변경하고 싶다면..

 => date -s '2017-08-29 14:08:31'

 

posted by 유돌이
2019. 9. 19. 10:00 유닉스*리눅스*SE

1.  vi /etc/vsftpd/vsftpd.conf 열기
2. 아래항목 추가 및 저장
 => pasv_enable=YES
    pasv_min_port=50000
    pasv_max_port=50001

3. 포트추가
 => vi /etc/sysconfig/iptables 
 => -A INPUT -p tcp -m state --state NEW -m tcp --dport 50000 -j ACCEPT
    -A INPUT -p tcp -m state --state NEW -m tcp --dport 50001 -j ACCEPT

4. 서비스 재시작
 => service vsftpd restart
 => service iptables restart

posted by 유돌이
2019. 9. 19. 10:00 유닉스*리눅스*SE

[apache 설정]

 

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^([^.]+)$ $1.php [L]

 

 

[nginx 설정]

try_files $uri $uri.html $uri/ @extensionless-php;

 

location @extensionless-php {               

        rewrite ^(.*)$ $1.php last;

 }

posted by 유돌이
2019. 9. 19. 09:58 유닉스*리눅스*SE

[복사]
cp 파일명 /폴더/파일명
[폴더 전체 복사]
cp -r 원본폴더/ 목적지폴더/

[이동]
mv 파일명 /폴더명/파일명
[폴더 전체 이동]
mv -r 원본폴더/ 목적지폴더/

[삭제]
rm 파일명
[전체삭제]
rm -rf 폴더명


[프로세스 개수]
ps -ef | grep celery | wc -l

[CPU 개수]
grep ^processor /proc/cpuinfo | wc -l

[RAM 사이즈]
free -m

posted by 유돌이
2019. 9. 18. 12:00 유닉스*리눅스*SE

ntsysv와 chkconfig는 사용방법과 실행결과에 조금씩 차이는 있으나 부팅시에 자동 실행할 서비스들을 관리한다는 점에서 같은 목적을 가진 도구이다.
즉, 두가지 모두 런레벨에 따른 자동실행 서비스를 설정하는 역활을 하게 된다.  

 1. ntsysv
   리눅스 부팅시 각 부팅레벨 (0번부터 6번까지)별로 실행시키거나 실행시키지 않을 서비스들을 설정하는 유틸리티이다.
 이 유틸리티는 setup를 실행하여 "System service" 항목을 선택하여 실행 할 수 있다.
 
 - 설정법 :  nesysv --level [0123456]        예) ntsysv --level 35  
   1023456중 하나만 선택해도 되고 2개이상 선택해도 된다. 만약 --level옵션을 사용하지 않는다면 현재 런레벨의 설정이 변경 된다. 

     
 
2. chkconfig
chkconfig는 /etc/rc.d/rcN.d의 각디렉토리에 있는 S로 시작하는 링크파일과 K로 시작하는 링크파일을 생성/삭제함으로써 부팅시에 자동실행할
서비스를 결정할 수 있다.

 1) chkconfig 리스트 확인



2) chkconfig 리스트항목에 서비스 등록 및 제거
  - 등록 : chkconfig --add 서비스명 
    서비스 등록시 /etc/rc.d/rcN.d 디렉토리에 해당서비스의 링크파일이 생성된다.  
 


 
 - 제거 : chkconfig --del 서비스명
    서비스 제거시 /etc/rc.d/rcN.d 디렉토리에 해당서비스의 링크파일이 삭제 된다.



3) 부팅시 특정 서비스 자동실행 설정하기 (chkconfig 리스트의 on, off 설정)
 - 자동실행 설정 (on으로 설정) :  chkconfig --level [런레벨] [설정할데몬명] on   예) chkconfig --level 35 httpd on (httpd의3,5런레벨을 자동실행)
   * --level 옵션을 사용하지 않으면 런레벨 2,3,4,5 번이 on으로 적용 된다.
 


  
 - 자동실행 해제 설정 (off 로 설정) : chkconfig --level [런레벨] [설정할데몬명] off   예) chkconfig --level 35 httpd off (httpd의3,5런레벨을 자동실행 해제)
     * --level 옵션을 사용하지 않으면 런레벨 2,3,4,5 번이 off으로 적용 된다.



4) 기타참고 사항
 - ntsysv(서비스목록에 등록됨) = chkconfig로 서비스 등록시 :   /etc/rc.d/rcN.d/디렉토리에 해당 링크파일이 생성된다.
 - ntsysv(*설정)와 chkconfig로 서비스 on 설정시              :   /etc/rc.d/rcN.d/디렉토리에 해당 링크파일의 앞자리가 S로 표시됨.
 - ntsysv(*설정 해제)와 chkconfig로 서비스 off 설정시        :   /etc/rc.d/rcN.d/디렉토리에 해당 링크파일의 앞자리가 N로 표시됨.
 - ntsysv(서비스목록이 없어짐) = chkconfig로 서비스 제거시   :   /etc/rc.d/rcN.d/디렉토리에 해당 링크파일이 삭제 됨

출처 : http://light99.egloos.com/5142536

'유닉스*리눅스*SE' 카테고리의 다른 글

apache / nginx 에서 .php 생략하기  (0) 2019.09.19
리눅스 명령어  (0) 2019.09.19
CentOS MariaDB 설치하는법  (0) 2019.09.18
[python] pip command not found 해결법  (0) 2019.09.17
[python] 웹페이지 상태 체크  (0) 2019.09.17
posted by 유돌이
2019. 9. 18. 12:00 유닉스*리눅스*SE

1. CentOS MariaDB 10.1.9 설치
 1.1. vi /etc/yum.repos.d/MariaDB.repo 아래내용 입력후 저장
   => [mariadb]
      name = MariaDB
      baseurl = http://yum.mariadb.org/10.1/centos7-amd64
      gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
      gpgcheck=1
 1.2. yum install -y MariaDB MariaDB-server MariaDB-client
 1.3. mysql --version (mariaDB 버전확인)
 1.4. Mariadb 상태 변경 및 확인
   => systeomctl start mariadb  (시작)
   => systeomctl enable mariadb  (부팅시 자동실행 설정)
   => systeomctl status mariadb  (상태확인)
   => systeomctl stop mariadb    (정지)
   => systeomctl restart mariadb    (재시작)
 1.5. mysql_secure_installation  (root 비번설정)
=======================================================================
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password:        // 비빌번호설정
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y    
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y       // 원격접속
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
=======================================================================

posted by 유돌이
2019. 9. 17. 10:38 유닉스*리눅스*SE

[pip 설치]
sudo yum install python-pip

posted by 유돌이