来谈谈:基于gentoo安装Nginx php mysql的办法
对于linux命令,一定要学会用man和info去查他们的解释;1、先在/etc/make.conf到场sync站点,待会儿要用emerge举行同步。
.代码以下:
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
在实行emerge--sync同步portage树。
2、晋级portage版本,要不待会儿安装mysql的时分会提醒portage版本旧的!
.代码以下:
emergeportage
先界说USE:
.代码以下:
/etc/portage/package.use
dev-lang/phpclimingxmlftpcurlpdomysqlimysqlsqlitejsoncgictypegdhash
www-servers/nginxfastcgi
编纂/etc/portage/package.keywords
www-servers/spawn-fcgi~x86
3、安装mysqlnginxphpspawn-fcgipecl-apcpecl-memcache。
.代码以下:
emergemysqlnginxphpspawn-fcgipecl-apcpecl-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
vim/etc/mysql/my.cnf
port=3306
socket=/var/run/mysqld/mysqld.sock
prompt="(u:s135>"
no-auto-rehash
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
quick
max_allowed_packet=16M
mysqladmin-urootpassword""
启动mysql
/etc/init.d/mysqlstart
5、设置nginx
vim/etc/nginx/nginx.conf
.代码以下:
usernginxnginx;
worker_processes1;
error_log/var/log/nginx/nginx_error.logcrit;
pid/var/run/nginx.pid;
#Specifiesthevalueformaximumfiledescriptorsthatcanbeopenedbythisprocess.
worker_rlimit_nofile52100;
events
{
useepoll;
worker_connections52100;
}
http
{
includemime.types;
default_typeapplication/octet-stream;
#charsetgb2312;
server_names_hash_bucket_size128;
client_header_buffer_size32k;
large_client_header_buffers432k;
client_max_body_size8m;
sendfileon;
tcp_nopushon;
keepalive_timeout7020;
tcp_nodelayon;
server_tokensoff;
fastcgi_connect_timeout300;
fastcgi_send_timeout300;
fastcgi_read_timeout300;
fastcgi_buffer_size64k;
fastcgi_buffers464k;
fastcgi_busy_buffers_size128k;
fastcgi_temp_file_write_size128k;
gzipoff;
gzip_min_length1k;
gzip_buffers416k;
gzip_http_version1.0;
gzip_comp_level2;
gzip_typestext/plainapplication/x-javascripttext/cssapplication/xml;
gzip_varyon;
server
{
server_namewww.freebsdsystem.org;
root/data0/www/wwwroot/;
indexindex.htmlindex.htmindex.php;
location~.*.php?$
{
#fastcgi_passunix:/tmp/php-cgi.sock;
fastcgi_pass127.0.0.1:9000;
fastcgi_indexindex.php;
includefcgi.conf;
}
location~.*.(gif|jpg|jpeg|png|bmp|swf)$
{
expires30d;
}
location~.*.(js|css)?$
{
expires1h;
}
log_formatblog$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.logblog;
}
}
设置spawn-fcgi
.代码以下:
vim/usr/local/bin/php-fcgi
#!/bin/sh
#author:coralzd
#poweredbywww.freebsdsystem.org
bin=/usr/bin/php-cgi
case$1in
start)
echo"startingphp-cgi"
spawn-fcgi-a127.0.0.1-p9000-C8-unginx-gnginx-f/usr/bin/php-cgi2>&1>/dev/null&
echo"Done"
stop)
killallphp-cgi
echo"php-cgistop"
*)
echo"usagestart|stop";;
esac
6、开机启动nginxmysql
.代码以下:
rc-updateaddnginxdefault
rc-updateaddmysqldefault
至此设置完成!
看不懂man文档的人.在linux中,命令可分为系统基本命令和应用程序命令.系统基本命令是所有的unix类系统都支持的命令,走到哪都不变,只要是unix类系统上就肯定有. 一定要养成在命令行下工作的习惯,要知道X-window只是运行在命令行模式下的一个应用程序。在命令行下学习虽然一开始进度较慢。 不同于Windows?系统需要花钱购买,因为Linux的核心是免费的,自由使用的,核心源代码是开放的。 直到学习Linux这门课以后,我才知道,原来我错了。? 在系统检测不到与Linux兼容的显卡,那么此次安装就可能不支持图形化界面安装,而只能用文本模式安装等等。 对于英语不是很好的读者红旗 Linux、中标Linux这些中文版本比较适合。现在一些Linux网站有一些Linux版本的免费下载,这里要说的是并不适合Linux初学者。 Windows?是图形界面的,Linux类似以前的?DOS,是文本界面的,如果你运行了图形界面程序X-WINDOWS后,Linux?也能显示图形界面,也有开始菜单、桌面、图标等。 对我们学习操作系统有很大的帮助,加深我们对OS的理解。? 请问谁有Linux的学习心得的吗?简单的说说?
页:
[1]