Apache + PHP + MySQL

Posted at 2009. 11. 11. 08:20 | Posted in Server/Ubuntu
반응형

#  apt-get install mysql-server

utf-8, innodb 설정

# vi /etc/mysql/my.cnf

# utf-8
[client]
default-character-set=utf8  

[mysqld]   
character-set-client-handshake=FALSE  
init_connect="SET collation_connection=utf8_general_ci"  
init_connect="SET NAMES utf8"  
default-character-set=utf8  
character-set-server=utf8  
collation-server=utf8_general_ci  

# InnoDB
default-storage-engine=INNODB

# 테이블명의 대소문자를 가리지 않게 한다.
lower_case_table_names = 1

[mysqldump]    
default-character-set=utf8

[mysql]   
default-character-set=utf8

# 외부에서도 접속 가능하게 한다.
# bind-address          = 127.0.0.1

mysql 재시작

# /etc/init.d/mysql restart

설정 확인

# mysql -uroot -p비밀번호
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 35
Server version: 5.1.37-1ubuntu5 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> status
--------------
mysql  Ver 14.14 Distrib 5.1.37, for debian-linux-gnu (i486) using  EditLine wrapper

Connection id:          35
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.1.37-1ubuntu5 (Ubuntu)
Protocol version:       10
Connection:             Localhost via UNIX socket
Client characterset:    utf8
Server characterset:    utf8
UNIX socket:            /var/run/mysqld/mysqld.sock
Uptime:                 1 min 59 sec

Threads: 1  Questions: 102  Slow queries: 0  Opens: 99  Flush tables: 1  Open tables: 23  ....
--------------

mysql> show engines;
| InnoDB     | DEFAULT | Supports transactions, row-level locking, and foreign keys ....

mysql> exit
Bye



apache2

# apt-get install apache2
# apt-get install libapache2-mod-auth-mysql

ServerName 등록

# vi /etc/apache2/apache2.conf

# ServerName
ServerName nerv-team.co.kr

가상 호스트 설정

#  vi /etc/apache2/sites-enabled/000-default

# nerv-team.co.kr
<VirtualHost *:80>
        ServerName nerv-team.co.kr
        Redirect / http://www.nerv-team.co.kr/
</VirtualHost>
# www.nerv-team.co.kr
<VirtualHost *:80>
        ServerAdmin antop@nerv-team.co.kr
        ServerName www.nerv-team.co.kr
        ServerAlias nerv-team.co.kr
        DocumentRoot /var/www
        ....
</VirtualHost>

http://nerv-team.co.kr 으로 접속해도 http://www.nerv-team.co.kr 으로 갈 수 있도록 수정


apache2 재시작

# /etc/init.d/apache2 restart

테스트





php5

# apt-get install php5
# apt-get install php5-gd php5-imap
# apt-get install php5-mhash
# apt-get install php5-mysql
# apt-get install php5-pgsql

설정

# vi /etc/php5/apache2/php.ini

; 추가
date.timezone = Asia/Seoul
[PHP]
default_charset = "UTF-8"
output_buffering = 4096

....

; 수정
magic_quotes_gpc = Off

apache2 재시작

# /etc/init.d/apache2 restart

테스트

# echo '<?php phpinfo(); ?>' > /var/www/phpinfo.php





phpmyadmin

# apt-get install phpmyadmin

apache2 선택



기본 http://www.nerv-team.co.kr/phpmyadmin 으로 되어 있지만 http://mysql.nerv-team.co.kr 으로 변경

# rm /etc/apache2/conf.d/phpmyadmin.conf

서브 도메인 설정

# vi /etc/apache2/sites-enabled/000-default

# 추가
# mysql.nerv-team.co.kr
<VirtualHost *:80>
        ServerName mysql.nerv-team.co.kr
        DocumentRoot /usr/share/phpmyadmin
</VirtualHost>

apache2 재시작

# /etc/init.d/apache2 restart

테스트



반응형

'Server > Ubuntu' 카테고리의 다른 글

Openfire  (0) 2010.05.25
Webmin  (0) 2009.11.18
Squirrelmail  (0) 2009.11.12
SparkWeb  (0) 2009.11.12
Cacti  (0) 2009.11.12
Apache + SSL  (0) 2009.11.12
Oracle Express Edition 10g  (0) 2009.11.11
Apache + Tomcat with Tomcat Connector  (0) 2009.11.11
bind9 - domain name service  (0) 2009.11.11
Ubuntu 9.10 Desktop  (0) 2009.11.11
//