基于gentoo怎么安装Nginx,php和mysql

网友投稿 792 2023-07-02

基于gentoo怎么安装Nginx,php和mysql

基于gentoo怎么安装Nginx,php和mysql

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.usedev-lang/php cli ming xml ftp curl pdo mysqli mysql sqlite json cgi ctype gd hashwww-servers/nginx fastcgi编辑/etc/portage/package.keywordswww-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/datamysql_install_db --user=mysql --basedir=/usr --datadir=/data0/mysql/data

配置my.cnf

复制代码 代码如下:

rm -f /etc/mysql/my.cnfvim /etc/mysql/my.cnf[client]port = 3306socket = /var/run/mysqld/mysqld.sock[mysql]prompt="(\u:s135[\d]> "no-auto-rehash[mysqld]bind-address = 173.252.207.109user = mysqlport = 3306socket = /var/run/mysqld/mysqld.sockbasedir = /usrdatadir = /data0/mysql/dataopen_files_limit = 600back_log = 20max_connections = 100max_connect_errors = 200table_cache = 60external-locking = falsemax_allowed_packet = 16msort_buffer_size = 128kjoin_buffer_size = 128kthread_cache_size = 10thread_concurrency = 8query_cache_size = 0mquery_cache_limit = 2mquery_cache_min_res_unit = 2kdefault_table_type = myisamthread_stack = 192ktransaction_isolation = read-uncommittedtmp_table_size = 512kmax_heap_table_size = 32m/var/log/slow.log/var/log/error.loglong_query_time = 1log_long_formatserver-id = 1#log-bin = /usr/local/mysql/data/binlogbinlog_cache_size = 2mmax_binlog_cache_size = 4mmax_binlog_size = 512mexpire_logs_days = 7key_buffer_size = 4mread_buffer_size = 1mread_rnd_buffer_size = 2mbulk_insert_buffer_size = 2mmyisam_sort_buffer_size = 4mmyisam_max_sort_file_size = 10gmyisam_max_extra_sort_file_size = 10gmyisam_repair_threads = 1myisam_recover[mysqldump]quickmax_allowed_packet = 16mmysqladmin -uroot password ""

启动mysql/etc/init.d/mysql start5、配置nginxvim /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{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 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 freebsdsystem.orgbin=/usr/bin/php-cgicase $1 instart)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-cgiecho "php-cgi stop"*)echo "usage start|stop";;esac

6、开机启动 nginx mysql

复制代码 代码如下:

rc-update add nginx defaultrc-update add mysql default

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:mysql comment的概念是什么
下一篇:怎么查看IIS、PHP、MySQL的日志
相关文章