基於gentoo怎麼安裝Nginx,php和mysql

WBOY
發布: 2023-06-02 17:16:04
轉載
1515 人瀏覽過

1、先在/etc/make.conf加入sync網站,待會兒要用emerge進行同步。

複製程式碼 程式碼如下:

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

在執行emerge --sync 同步portage樹。
2、升級portage 版本,要不待會兒安裝mysql的時候會提示portage 版本舊的!

複製程式碼 程式碼如下:

emerge portage

#先定義use:

##複製程式碼 程式碼如下:

#/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
編輯/etc/portage/ package.keywords
www-servers/spawn-fcgi ~x86

3、安裝mysql nginx php spawn-fcgi pecl-apc pecl-memcache。


複製程式碼 程式碼如下:

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

#4、設定mysql。


複製程式碼 程式碼如下:

mkdir -p /data0/mysql/data

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

配置my.cnf


複製程式碼 程式碼如下:

rm -f /etc/mysql/my.cnf

vm / 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##errmax_connect_> 200
table_cache = 60
external-locking = false
max_allowed_pa​​cket = 16m
sort_buffer_size = 128k
join_buffer_size = 128k
thread_cache_size =join_buffer_size = 128k
thread_cache_size = 100 月 =#30ache_cache_#0ache_cache_size = 100 月 =#30ache_cache_#urrache_cache_m00 月_ 0m
query_cache_limit = 2m
query_cache_min_res_unit = 2k
default_table_type = myisam
thread_stack = 192k
transaction_isolation = read-un_mitted_stack = 192k
transaction_isolation = read-un_mteds_#3_table_sizes_a_a_s_s_smax /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##expire_logs_days = 7
key_buffer_size = 4m##g; size = 2m
myisam_sort_buffer_size = 4m
myisam_max_sort_file_size = 10g
myisam_max_extra_sort_file_size = 10g
myisam_repair_threads = 1##my_mfh; mysqladmin - uroot password ""



啟動mysql
/etc/init.d/mysql start
#5、設定nginx
vim /etc/nginx/nginx.conf


複製程式碼 程式碼如下:


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
{##worker_rlimit_nofile 52100;

events

{

{{
#;
worker_connections 52100;
}
http
{
include mime.types;
default_type application/octet-stream;
#charset gb2312;
server_names_hash_bucket_size 128;#128; ##client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
sendfile on;
tcp_nopush on;
keepa_#fall; ##fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k; 28k;
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/Y #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;
}
}

spawn-fcgi


複製程式碼 程式碼如下:

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、開機啟動nginx mysql

##複製程式碼 程式碼如下:

rc-update add nginx default

rc-update add mysql default                            

####################'起來)

以上是基於gentoo怎麼安裝Nginx,php和mysql的詳細內容。更多資訊請關注PHP中文網其他相關文章!

相關標籤:
來源:yisu.com
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板