nginx php설정

리눅스 공부 2014. 9. 29. 10:12

NGINX 설정

Nginx의 설정 파일을 수정한다.

설정파일은 아래의 위치 중의 하나에 있다.

  • /etc/nginx/conf.d/default.conf
  • /etc/nginx/sites-available/default

다음은 필자의 설정파일이다.

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
32
33
34
35
36
37
38
39
40
41
42
43
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
root /usr/share/nginx/html;
location / {
index index.html index.htm index.php;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/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$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$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;
#}
}

위의 내용을 그대로 사용하면 PHP 보안 문제가 있다. 아래 링크를 따라가면 몇가지 보안 이슈를 해결 할 수 있는 정보가 있다. 참고하자. http://phpschool.com/gnuboard4/bbs/board.php?bo_table=tipntech&wr_id=77007&page=#c_77013

출처~ http://opentutorials.org/module/384/4332

'리눅스 공부' 카테고리의 다른 글

mysql 기본 명령어  (0) 2014.09.29
mysql 비번설정  (0) 2014.09.29
포트 열기  (0) 2014.09.25
smb 삼바서버 설치  (0) 2014.09.25
소스파일 받는곳 gcc pcre zlib  (0) 2014.09.25
Posted by KyeomKim
,

포트 열기

리눅스 공부 2014. 9. 25. 17:25

리눅스 80 포트 방화벽 열기

 

[root@myhost] vi /etc/sysconfig/iptables

 

 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

[root@myhost] /etc/init.d/iptables restart​

 

 

다른 포트를 열고 싶으면 포트 번호만 변경하면 된다.


http://blog.naver.com/fantasisty/220095507842


리눅스 포트열기

patfenguin.egloos.com/1167150

iptables -I INPUT 1 -p tcp --dport 21 -j ACCEPT
iptables -I OUTPUT 1 -p tcp --dport 21 -j ACCEPT 
service iptables save
service iptables restart


열려있는 모든 포트 확인법
# netstat -nap

 LISTEN 되는 모든 포트
# netstat -l (netstat -nap | grep LISTEN)

모든 서비스 동시 접속자 수
# netstat -nap | grep ESTABLISHED | wc -l

웹 동시 접속자 수
# netstat -nap | grep :80 | grep ESTABLISHED | wc -l




'리눅스 공부' 카테고리의 다른 글

mysql 비번설정  (0) 2014.09.29
nginx php설정  (0) 2014.09.29
smb 삼바서버 설치  (0) 2014.09.25
소스파일 받는곳 gcc pcre zlib  (0) 2014.09.25
mysql 컴파일 설치  (0) 2014.09.25
Posted by KyeomKim
,

samba설치

# yum install samba

  samba-3.4.2 가 설치된다. (09/12/02기준)


samba설정
vi /etc/samba/smb.conf

[global]

        workgroup = icom  ----------> 보통윈도우에서 Workgroup이라고 말하는 그룹이다.
        server string = D201GLY -----> 컴퓨터 네트워크 이름이다. 

        security = user    => PC에서 처음 접촉시 로그인 필요
        security = share   => 로그인을 사용 안함.  따라서 누구나 다 접촉이 가능하게 하려면 nobody을 사용할 수도 있음. 

        guest account = nobody      이것을 다음과 같이 nobody로

[test] -> PC에서 test 디렉토리로 보임.
        comment = test
        path = /root/test     ---> 공유 허용할 디렉토리
        writeable = yes       ---> 쓰기 가능 하도록
        create mask = 777        -> 파일 생성 시 파일의 권한을 777로 만듬.
        directory maks = 755    -> 디렉토리 생성 시 파일의 권한을 777로 만듬.
;       browseable = yes
        valid users = root, scsong, nobody  -> 여기 설정된 사람만 허용한다.
        guest ok = yes

사용해 보지는 않았지만 참고 해야할 설정 들
[global]

 

   unix password sync = Yes

 

   socket options = TCP_NODELAY

   socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 => 버퍼를 제한하는 건데, 필요 없을 듯.

   dns proxy = No

 

  공용 일 때는 아무래도 접속 대상을 정해야 보안이 좋아 진다..

   ;  hosts allow = 192.168.1. 192.168.2. 127.   ==> 이 설정을 살리고 원하는 subnetwork 설정

    => 192.168.1.*, 192.168.2.*, 127.*.*.* 에서 만 열 수 있다.


한글 처리에 문제가 있을 때

[global]

      dos charset = cp949
      display charset = UTF8
      unix charset = UTF8


계정생성linux->window


/usr/bin/smbpasswd -a 계정이름


방화벽 끄기

lokkit -q --disabled

selinux 끄기

/usr/sbin/setenforce 0


mount하기
 윈도우->linux

# mount -t cifs //192.168.0.xxx/공유이름      /mnt(마운트할 위치)

  비번을 물어보는데 비번을 적어준다 (리눅스는 윈도우처럼 *이 안뜬다)

-t 는 files system option 
cifs 는 smb가 사용하는 file system을 말한다.(대충)

//ip 에 접속하여 mount한다.


mount 해제

# umount -t cifs /mnt(마운트한 위치)

프로세스가 다 죽었어도 busy 에러가 뜰때가있는데

자기가 자신이 그 폴더에 있어도 에러가 뜬다.



http://adminplay.com/LETC/72276


'리눅스 공부' 카테고리의 다른 글

nginx php설정  (0) 2014.09.29
포트 열기  (0) 2014.09.25
소스파일 받는곳 gcc pcre zlib  (0) 2014.09.25
mysql 컴파일 설치  (0) 2014.09.25
우분투 sql 설치  (0) 2014.09.18
Posted by KyeomKim
,