The method of installing Nginx PHP MySQL based on Gentoo _linux

Source: Internet
Author: User
Tags apc php cli php mysql rsync
1, first in the/etc/make.conf to join the sync site, later to use emerge to synchronize.
Copy Code code as follows:

Sync= "Rsync://rsync.gentoo.org/gentoo-portage"

In the Execute emerge--sync Sync portage tree.
2, upgrade portage version, or later install MySQL will be prompted Portage version of the old!
Copy Code code as follows:

Emerge Portage

Define use first:
Copy Code code as follows:

/etc/portage/package.use
dev-lang/php CLI Ming XML ftp Curl PDO mysqli MySQL sqlite json CGI CType GD Hash
Www-servers/nginx fastcgi
Edit/etc/portage/package.keywords
www-servers/spawn-fcgi ~x86

3, install MySQL nginx php spawn-fcgi pecl-apc pecl-memcache.
Copy Code code as follows:

emerge MySQL nginx php spawn-fcgi pecl-apc pecl-memcache

4, configure MySQL.
Copy Code code as follows:

Mkdir-p/data0/mysql/data
mysql_install_db--user=mysql--basedir=/usr--datadir=/data0/mysql/data

Configure MY.CNF
Copy Code code as follows:

Rm-f/etc/mysql/my.cnf
Vim/etc/mysql/my.cnf
[Client]
Port = 3306
Socket =/var/run/mysqld/mysqld.sock
[MySQL]
Prompt= "(\u:s135[\d]>)
No-auto-rehash
[Mysqld]
Bind-address = 173.252.207.109
user = MySQL
Port = 3306
Socket =/var/run/mysqld/mysqld.sock
Basedir =/usr
DataDir =/data0/mysql/data
Open_files_limit = 600
Back_log = 20
max_connections = 100
Max_connect_errors = 200
Table_cache = 60
external-locking = FALSE
Max_allowed_packet = 16M
Sort_buffer_size = 128K
Join_buffer_size = 128K
Thread_cache_size = 10
Thread_concurrency = 8
Query_cache_size = 0M
Query_cache_limit = 2M
Query_cache_min_res_unit = 2k
Default_table_type = MyISAM
Thread_stack = 192K
Transaction_isolation = read-uncommitted
Tmp_table_size = 512K
Max_heap_table_size = 32M
/var/log/slow.log
/var/log/error.log
Long_query_time = 1
Log_long_format
Server-id = 1
#log-bin =/usr/local/mysql/data/binlog
Binlog_cache_size = 2M
Max_binlog_cache_size = 4M
Max_binlog_size = 512M
Expire_logs_days = 7
Key_buffer_size = 4M
Read_buffer_size = 1M
Read_rnd_buffer_size = 2M
Bulk_insert_buffer_size = 2M
Myisam_sort_buffer_size = 4M
Myisam_max_sort_file_size = 10G
Myisam_max_extra_sort_file_size = 10G
Myisam_repair_threads = 1
Myisam_recover
[Mysqldump]
Quick
Max_allowed_packet = 16M
Mysqladmin-uroot password ""

Start MySQL
/etc/init.d/mysql start
5. Configure Nginx
Vim/etc/nginx/nginx.conf
Copy Code code as follows:

User Nginx Nginx;
Worker_processes 1;
Error_log/var/log/nginx/nginx_error.log Crit;
Pid/var/run/nginx.pid;
#Specifies the value for maximum file descriptors the can is opened by this process.
Worker_rlimit_nofile 52100;
Events
{
Use Epoll;
Worker_connections 52100;
}
http
{
Include Mime.types;
Default_type Application/octet-stream;
#charset gb2312;
Server_names_hash_bucket_size 128;
Client_header_buffer_size 32k;
Large_client_header_buffers 4 32k;
Client_max_body_size 8m;
Sendfile on;
Tcp_nopush on;
Keepalive_timeout 70 20;
Tcp_nodelay on;
Server_tokens off;
Fastcgi_connect_timeout 300;
Fastcgi_send_timeout 300;
Fastcgi_read_timeout 300;
Fastcgi_buffer_size 64k;
Fastcgi_buffers 4 64k;
Fastcgi_busy_buffers_size 128k;
Fastcgi_temp_file_write_size 128k;
gzip off;
Gzip_min_length 1k;
Gzip_buffers 4 16k;
Gzip_http_version 1.0;
Gzip_comp_level 2;
Gzip_types text/plain application/x-javascript text/css application/xml;
Gzip_vary on;
Server
{
server_name www.freebsdsystem.org;
root/data0/www/wwwroot/;
Index index.html index.htm index.php;
Location ~. *\.php?$
{
#fastcgi_pass Unix:/tmp/php-cgi.sock;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Include fcgi.conf;
}
Location ~. *\. (gif|jpg|jpeg|png|bmp|swf) $
{
Expires 30d;
}
Location ~. *\. (JS|CSS)? $
{
Expires 1h;
}
Log_format blog ' $remote _addr-$remote _user [$time _local] ' $request '
' $status $body _bytes_sent ' $http _referer '
' $http _user_agent ' $http _x_forwarded_for ';
Access_log/var/log/nginx/blog.log blog;
}
}

Configure spawn-fcgi
Copy Code code as follows:

vim/usr/local/bin/php-fcgi
#!/bin/sh
# AUTHOR:CORALZD
# Powered by www.freebsdsystem.org
bin=/usr/bin/php-cgi
Case is in
Start
echo "Starting php-cgi"
Spawn-fcgi-a 127.0.0.1-p 9000-c 8-u nginx-g nginx-f/usr/bin/php-cgi 2>&1 >/dev/null &
echo "Done"

Stop
Killall php-cgi
echo "php-cgi Stop"

*)
echo "Usage start|stop";;
Esac

6, boot Nginx MySQL
Copy Code code as follows:

Rc-update Add nginx Default
Rc-update Add MySQL Default

This configuration is complete!
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.