仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 522|回复: 8
打印 上一主题 下一主题

[其他Linux] 来谈谈:基于gentoo安装Nginx php mysql的办法

[复制链接]
乐观 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-1-16 17:27:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
对于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
[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-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类系统上就肯定有.
分手快乐 该用户已被删除
沙发
发表于 2015-1-18 18:03:03 | 只看该作者
一定要养成在命令行下工作的习惯,要知道X-window只是运行在命令行模式下的一个应用程序。在命令行下学习虽然一开始进度较慢。
老尸 该用户已被删除
板凳
发表于 2015-1-26 16:36:39 | 只看该作者
不同于Windows?系统需要花钱购买,因为Linux的核心是免费的,自由使用的,核心源代码是开放的。
精灵巫婆 该用户已被删除
地板
发表于 2015-2-4 20:34:50 | 只看该作者
直到学习Linux这门课以后,我才知道,原来我错了。?
蒙在股里 该用户已被删除
5#
发表于 2015-2-10 08:20:47 | 只看该作者
在系统检测不到与Linux兼容的显卡,那么此次安装就可能不支持图形化界面安装,而只能用文本模式安装等等。
若天明 该用户已被删除
6#
发表于 2015-3-1 06:32:44 | 只看该作者
对于英语不是很好的读者红旗 Linux、中标Linux这些中文版本比较适合。现在一些Linux网站有一些Linux版本的免费下载,这里要说的是并不适合Linux初学者。
7#
发表于 2015-3-10 13:02:49 | 只看该作者
Windows?是图形界面的,Linux类似以前的?DOS,是文本界面的,如果你运行了图形界面程序X-WINDOWS后,Linux?也能显示图形界面,也有开始菜单、桌面、图标等。
柔情似水 该用户已被删除
8#
发表于 2015-3-17 08:08:11 | 只看该作者
对我们学习操作系统有很大的帮助,加深我们对OS的理解。?
飘飘悠悠 该用户已被删除
9#
发表于 2015-3-24 03:28:49 | 只看该作者
请问谁有Linux的学习心得的吗?简单的说说?
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-9-27 20:40

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表