Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Nginx,php and mysql based on gentoo

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article "based on gentoo how to install Nginx,php and mysql" is not understood by most people, so the editor summarizes the following, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to install Nginx,php and mysql based on gentoo" article.

1. Join the sync site in / etc/make.conf first, and then use emerge to synchronize later.

The copy code is as follows:

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

Synchronizing the portage tree with emerge-sync.

2. Upgrade the portage version, or you will be prompted for the old portage version when you install mysql later!

The copy code is as follows:

Emerge portage

Define use first:

The copy code is 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.

The copy code is as follows:

Emerge mysql nginx php spawn-fcgi pecl-apc pecl-memcache

4. Configure mysql.

The copy code is as follows:

Mkdir-p / data0/mysql/data

Mysql_install_db-user=mysql-basedir=/usr-datadir=/data0/mysql/data

Configure my.cnf

The copy code is 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 = 19K

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

The copy code is 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 that can be 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

The copy code is as follows:

Vim / usr/local/bin/php-fcgi

#! / bin/sh

# author:coralzd

# powered by www.freebsdsystem.org

Bin=/usr/bin/php-cgi

Case $1 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 and start nginx mysql

The copy code is as follows:

Rc-update add nginx default

Rc-update add mysql default

The above is about the content of this article on "how to install Nginx,php and mysql based on gentoo". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report