사용자 도구

사이트 도구


application:apache:suphp

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

application:apache:suphp [2015/10/29 01:44] (현재)
starlits 만듦
줄 1: 줄 1:
 +====== Howto install suphp for apache2 on ubuntu ======
  
 +===== ubuntu package install =====
 +  - apt를 이용하여 패키지를 받는다. <code>
 +apt-get install libapache2-mod-suphp suphp-common libapache2-mod-php5 php5-mysql
 +</code>
 +
 +===== /etc/suphp.conf =====
 +  - suphp 설정파일(/etc/suphp.conf)를 수정한다. <code>
 +[global]
 +;Path to logfile
 +logfile=/var/log/suphp/suphp.log
 +
 +;Loglevel
 +loglevel=info
 +
 +;User Apache is running as
 +webserver_user=www-data
 +
 +;Path all scripts have to be in
 +;docroot=/var/www:${HOME}/public_html
 +docroot=/
 +
 +;Path to chroot() to before executing script
 +;chroot=/mychroot
 +
 +; Security options
 +allow_file_group_writeable=false
 +allow_file_others_writeable=false
 +allow_directory_group_writeable=false
 +allow_directory_others_writeable=false
 +
 +;Check wheter script is within DOCUMENT_ROOT
 +check_vhost_docroot=true
 +
 +;Send minor error messages to browser
 +errors_to_browser=false
 +
 +;PATH environment variable
 +env_path=/bin:/usr/bin
 +
 +;Umask to set, specify in octal notation
 +;umask=0077
 +umask=0022
 +
 +; Minimum UID
 +min_uid=100
 +
 +; Minimum GID
 +min_gid=100
 +
 +[handlers]
 +;Handler for php-scripts
 +application/x-httpd-suphp="php:/usr/bin/php-cgi"
 +
 +;Handler for CGI-scripts
 +x-suphp-cgi="execute:!self"
 +
 +</code>
 +
 +===== /etc/apache2/mods-enabled/suphp.conf =====
 +  - php5 모듈을 중지시킨다. <code> # a2dismod php5 </code>
 +  - suphp 모듈을 활성화시킨다. <code> # a2enmod suphp </code>
 +  - apache2의 suphp.conf 설정을 한다. <code>
 +<IfModule mod_suphp.c>
 +    <FilesMatch "\.ph(p[345]?|tml)$">
 +        SetHandler application/x-httpd-suphp
 +    </FilesMatch>
 +    suPHP_AddHandler application/x-httpd-suphp
 +
 +    <Directory />
 +        suPHP_Engine on
 +    </Directory>
 +
 +    # By default, disable suPHP for debian packaged web applications as files
 +    # are owned by root and cannot be executed by suPHP because of min_uid.
 +    <Directory /usr/share>
 +        suPHP_Engine off
 +    </Directory>
 +
 +# # Use a specific php config file (a dir which contains a php.ini file)
 +#       suPHP_ConfigPath /etc/php5/cgi/suphp/
 +        suPHP_ConfigPath /etc/php5/cgi/suphp/
 +# # Tells mod_suphp NOT to handle requests with the type <mime-type>.
 +#       suPHP_RemoveHandler <mime-type>
 +</IfModule>
 +</code>
 +
 +===== /etc/php5/cgi/suphp/php.ini =====
 +  - apache2 설정파일인 suphp.conf 에 있는 php.ini 를 만들어 준다. <code>
 +# cd /etc/php5/cgi
 +# mkdir suphp
 +# cd suphp
 +# cp ../php.ini
 +</code>
 +  - <?php 이외에 <? 도 적용이 되도록 short_open_tag를 활성화시켜준다. <code>
 +# vi /etc/php5/cgi/suphp/php.ini
 +...
 +; starlits@adminschool.net
 +short_open_tag = On
 +...
 +</code>
 +
 +===== /etc/apache2/sites-enabled/001-adminschool.conf =====
 +  - virtual host 설정을 한다. <code>
 +<VirtualHost *:80>
 +    ServerName adminschool.net
 +    ServerAdmin webmaster@adminshcool.net
 +    DocumentRoot /home/admin/html
 +    <Directory /home/admin/html>
 +        Require all granted
 +    </Directory>
 +    <IfModule mod_suphp.c>
 +        suPHP_Engine on
 +    </IfModule>
 +    ErrorLog /var/log/apache2/adminschool.net-error.log
 +    CustomLog /var/log/apache2/adminschool.net-access.log combined env=!dontlog
 +</VirtualHost>
 +
 +</code>
application/apache/suphp.txt · 마지막으로 수정됨: 2015/10/29 01:44 저자 starlits