어제와 똑같이 살면서 다른 미래를 기대하지 말자

Macintosh Xampp 설정 본문

IT관심분야/Macintosh

Macintosh Xampp 설정

플랜액터 2009. 2. 23. 20:49
Apache 설정

1. 맥용 Xampp를 다운로드 후 설치한다. (설치 생략..)

2. 구동이 되는지 확인한다.
$ sudo /Applications/xampp/xamppfiles/mampp start
http://localhost 로 접속해서 확인..

3. 정상적으로 구동이 되었다면 보안설정을 한다.
$ sudo /Applications/xampp/xamppfiles/mampp security
XAMPP: Quick security check...
XAMPP: Your XAMPP pages are NOT secured by a password.
XAMPP: Do you want to set a password? [yes]
XAMPP: Password:
XAMPP: Password (again):
XAMPP: Password protection active. Please use 'xampp' as user name!
XAMPP: MySQL is accessable via network.
XAMPP: Normaly that's not recommended. Do you want me to turn it off? [yes]
XAMPP: Turned off.
XAMPP: MySQL has to run before I can check the security.
XAMPP: ProFTPD has a new FTP password. Great!
XAMPP: Do you want to change the password anyway? [no]
XAMPP: Done.

4. Xampp를 재시작하면 정지시 오류 구문이 발생한다. (아래와 같이 해결..)
/Applications/xampp/xamppfiles/bin/apachectl: line 70: ulimit: open files: cannot modify limit: Invalid argument
$ sudo vi /Applications/xampp/xamppfiles/bin/apachectl
68 # Set the maximum number of file descriptors allowed per child process.
69 if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
70     $ULIMIT_MAX_FILES
71 fi

아래와 같이 주석처리 한다.

68 # Set the maximum number of file descriptors allowed per child process.
69 #if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
70 #    $ULIMIT_MAX_FILES
71 #fi

5. httpd.conf 파일을 수정한다.
$ vi /Applications/xampp/xamppfiles/etc/httpd.conf

....
<Directory />
    Options FollowSymLinks
    AllowOverride None
    # Angelos - 2009.02.25 (주석처리를 해줘야 / 퍼미션 403 오류가 발생하지 않는다)
    #Order deny,allow
    #Deny from all
</Directory>
....
# Server-pool management (MPM specific)
#Include /Applications/xampp/etc/extra/httpd-mpm.conf

# Multi-language error messages
#Include /Applications/xampp/etc/extra/httpd-multilang-errordoc.conf

# Fancy directory listings
Include /Applications/xampp/etc/extra/httpd-autoindex.conf

# Language settings
Include /Applications/xampp/etc/extra/httpd-languages.conf

# User home directories
Include /Applications/xampp/etc/extra/httpd-userdir.conf

# Real-time info on requests and configuration
#Include /Applications/xampp/etc/extra/httpd-info.conf

# Virtual hosts
Include /Applications/xampp/etc/extra/httpd-vhosts.conf

# Local access to the Apache HTTP Server Manual
#Include /Applications/xampp/etc/extra/httpd-manual.conf

# Distributed authoring and versioning (WebDAV)
#Include /Applications/xampp/etc/extra/httpd-dav.conf

# Various default settings
Include /Applications/xampp/etc/extra/httpd-default.conf

# Secure (SSL/TLS) connections
#Include /Applications/xampp/etc/extra/httpd-ssl.conf

<IfDefine SSL>
        Include /Applications/xampp/etc/extra/httpd-ssl.conf
</IfDefine>
....

6. httpd-language.conf 파일을 수정한다. (utf8 설정)
$ sudo vi /Applications/xampp/xamppfiles/etc/extra/httpd-languages.conf
... 맨하단에 추가 ...
AddDefaultCharset UTF-8

7. httpd-userdir.conf 파일을 수정한다.
$ sudo vi /Applications/xampp/xamppfiles/etc/extry/httpd-userdir.conf

# Settings for user home directories
#
# Required module: mod_userdir

#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.  Note that you must also set
# the default access control for these directories, as in the example below.
#
#UserDir Sites

#
# Control access to UserDir directories.  The following is an example
# for a site where these directories are restricted to read-only.
#
<Directory "/Users/*/public_html">
    AllowOverride FileInfo AuthConfig Limit
    Options MultiViews SymLinksIfOwnerMatch IncludesNoExec
    <Limit GET POST OPTIONS>
        Order allow,deny
        Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS>
        Order deny,allow
        Deny from all
    </LimitExcept>
</Directory>

8. httpd-vhosts.conf 파일을 자신의 도메인에 맞게 잘~ 수정한다.

Mysql 설정

1. mysql 루트 패스워드를 설정한다.
$ /Applications/xampp/xamppfiles/bin/mysql -u root mysql
mysql> update user set password=password('패스워드') where user='root';
mysql> flush privileges;

2. 데이터베이스 생성 / 사용자 추가
mysql> create database DBNAME
mysql> grant all privileges on DBNAME.* to USERNAME@HOST_NAME identified by 'USER_PW';
mysql> flush privileges;

3. my.cnf 파일 설정
$ sudo vi /Applications/xampp/xamppfiles/etc/my.cnf
# Example MySQL config file for small systems.
#
# This is for a system with little memory (<= 64M) where MySQL is only used
# from time to time and it's important that the mysqld daemon
# doesn't use much resources.
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /Applications/xampp/xamppfiles/var/mysql) or
# ~/.my.cnf to set user-specific options.
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.

# The following options will be passed to all MySQL clients
[client]
default-character-set = utf8
#password       = your_password
port            = 3306
socket          = /Applications/xampp/xamppfiles/var/mysql/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[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
# commented out by xampp security
port            = 3306
port = 0
socket          = /Applications/xampp/xamppfiles/var/mysql/mysql.sock
skip-locking
key_buffer = 16K
max_allowed_packet = 1M
table_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64K

# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (using the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
server-id       = 1

# Uncomment the following if you want to log updates
#log-bin=mysql-bin

# Uncomment the following if you are NOT using BDB tables
#skip-bdb

# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /Applications/xampp/xamppfiles/var/mysql/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /Applications/xampp/xamppfiles/var/mysql/
#innodb_log_arch_dir = /Applications/xampp/xamppfiles/var/mysql/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50

[mysqldump]
default-character-set = utf8
quick
max_allowed_packet = 16M

[mysql]
default-character-set = utf8
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[isamchk]
key_buffer = 8M
sort_buffer_size = 8M

[myisamchk]
key_buffer = 8M
sort_buffer_size = 8M

[mysqlhotcopy]
interactive-timeout

4. 재실행 후 기본적으로 latin1 캐릭터 셋으로 설정되어 있는것이 utf8로 변경되었는지 확인한다.
mysql> show variables like 'c%';
+--------------------------+------------------------------------------------------+
| Variable_name            | Value                                                |
+--------------------------+------------------------------------------------------+
| character_set_client     | utf8                                                 |
| character_set_connection | utf8                                                 |
| character_set_database   | utf8                                                 |
| character_set_filesystem | binary                                               |
| character_set_results    | utf8                                                 |
| character_set_server     | utf8                                                 |
| character_set_system     | utf8                                                 |
| character_sets_dir       | /Applications/xampp/xamppfiles/share/mysql/charsets/ |
| collation_connection     | utf8_general_ci                                      |
| collation_database       | utf8_general_ci                                      |
| collation_server         | utf8_general_ci                                      |
| completion_type          | 0                                                    |
| concurrent_insert        | 1                                                    |
| connect_timeout          | 10                                                   |
+--------------------------+------------------------------------------------------+

PHP 설정

1. php.ini 파일을 수정한다.
$ sudo vi /Applications/xampp/xamppfiles/etc/php.ini
memory_limit = 64M      ; Maximum amount of memory a script may consume (8MB)
post_max_size = 100M
default_charset = "utf-8"
; Maximum allowed size for uploaded files.
upload_max_filesize = 100M
Comments