因为咱们一般购买的vps都是小内存,所以内存很重要,如果安装时不使用适合的调优参数,就会使得内存非常紧张,甚至,VPS也会无缘无故的出现各种问题。
因此可以使用一些其他的服务替代vps本身使用的软件,比如使用dropbear替代openssh,使用exim替代sendmail,mysql建议使用mariadb,这也是目前各个发行版都推荐的一个mysql分支了。本文也参考了古博的这篇文章。
因为咱们一般购买的vps都是小内存,所以内存很重要,如果安装时不使用适合的调优参数,就会使得内存非常紧张,甚至,VPS也会无缘无故的出现各种问题。
因此可以使用一些其他的服务替代vps本身使用的软件,比如使用dropbear替代openssh,使用exim替代sendmail,mysql建议使用mariadb,这也是目前各个发行版都推荐的一个mysql分支了。本文也参考了古博的这篇文章。
[root@localhost /]# rpm --import https://fedoraproject.org/static/0608B895.txt
[root@localhost /]# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm
[root@localhost /]# rpm –import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
[root@localhost /]# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
[root@localhost /]# yum install yum-priorities
编辑/etc/yum.repos.d/epel.repo
文件,启用这个源,使其优先级最高
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1 p
riority=10
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
[...]
Centos版本5.7,首先需要做的进行内核优化。下面是内核优化参数
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0 kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.tcp_sack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.netdev_max_backlog = 262144
net.core.somaxconn = 262144
net.ipv4.tcp_max_orphans = 3276800
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.ip_local_port_range = 1024 65000
由于Ubuntu 9.04已经包含了nginx,所以根本不要编译,安装超简单!
修改/etc/apt/sources.list
文件内容为国内镜像,然后运行:
apt-get update apt-get install nginx
即可完成安装。启动nginx:
/etc/init.d/nginx start
然后就可以访问http://localhost/
了,一切正常!如果不能访问,先不要继续,看看是什么原因,解决之后再继续。
继续阅读Ubuntu 9.04 Nginx+php+mysql