CentOS 5.3 + Nginx 0.7.x+ PHP 5.2.x+ MySQL 5.1.x服务器环境架[服务器安全]
本文“CentOS 5.3 + Nginx 0.7.x+ PHP 5.2.x+ MySQL 5.1.x服务器环境架[服务器安全]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
1、服务器软件环境信息
1.系统环境
Centos 5.3 i386/x86_64
Nginx 0.7.63
PHP 5.2.10,PHP 5.2.10 -fpm 0.5.13.diff
ZendOptimizer-3.3.3-linux-i386/x86_64
MySql-5.1.39-linux-i386/x86_64
2.系统约定
软件源代码包存放位置 /usr/local/src
源码包编译安装位置(prefix) /usr/local/software_xxx
脚本以及保护程序存放位置 /usr/local/sbin
MySQL 数据库位置 /var/lib/mysql(可按情形设置)
网站根目录 /home/wwwroot(可按情形设置)
虚拟主机日记根目录 /home/wwwroot/logs(可按情形设置)
运行账户 www:www
3.系统初始化设置
a.关掉selinux
# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing – SELinux security policy is enforced.
# permissive – SELinux prints warnings instead of enforcing.
# disabled – SELinux is fully disabled.
SELINUX=enforcing (改正成disabled)
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted – Only targeted network daemons are protected.
# strict – Full SELinux protection
SELINUXTYPE=targeted
b.关掉系统防火墙
永久性见效,重启后不会答复
# chkconfig iptables on (开启)
# chkconfig iptables off (关闭)
当即见效,重启后答复
# service iptables start (开启)
# service iptables stop (关闭)
c.更改系统启动方法:启动时进入字符终端情势
# vi /etc/inittab
··· ···
# Default runlevel. The runlevels used by RHS are:
# 0 – halt (Do NOT set initdefault to this)
# 1 – Single user mode
# 2 – Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 – Full multiuser mode
# 4 – unused
# 5 – X11
# 6 – reboot (Do NOT set initdefault to this)
#
id:5:initdefault: (改正成:id:3:initdefault:)
··· ··
阐明:
0:停机(记着不要把initdefault 设置为0,因为这样会使Linux无法启动 )
1:单用户情势,就像Win9X下的安全情势.
2:多用户,但是没有 NFS .
3:完好多用户情势,尺度的运行级.
4:普通不用,在一些特别情形下可以用它来做一些事情.
5:X11,即进到 X-Window 系统.
6:重新启动 (记着不要把initdefault 设置为6,因为这样会使Linux不断地重新启动).
d.得到系统位数,www.linuxidc.com按照系统位数安装相关mysql和ZendOptimizer版本
e.改换yum国内源
# uname -a
Linux localhost.localdomain 2.6.18-128.el5PAE #1 SMP Wed Jan 21 11:19:46 EST 2009 i686 i686 i386 GNU/Linux
# cd /etc/yum.repos.d
# mv CentOS-Base.repo CentOS-Base.repo.save
# wget http://centos.ustc.edu.cn/CentOS-Base.repo.5
# mv CentOS-Base.repo.5 CentOS-Base.repo
# yum clean all
f.利用 yum 对系统举行更新并且安装必要软件包
g.重启服务器
# yum update -y
# yum -y install make openssl openssl-devel pcre pcre-devel libpng libpng-devel libjpeg-6b libjpeg-devel-6b freetype freetype-devel gd gd-devel zlib zlib-devel gcc gcc-c++ libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 curl curl-devel
2、需求预备的软件源码
1.预备软件
新建一个down.txt的文本,并上传至/usr/local/src目录下,工具系统位数下载对应的MySql和ZendOptimizer内容以下:
# init 6 大概
# reboot
http://sysoev.ru/nginx/nginx-0.7.63.tar.gz
http://download.scientificlinux.net/nginx
http://download.scientificlinux.net/php-fpm.conf
http://download.scientificlinux.net/nginx.conf
http://download.scientificlinux.net/fcgi.conf
http://download.scientificlinux.net/php-5.2.10.tar.gz
http://download.scientificlinux.net/php-5.2.10-fpm-0.5.13.diff.gz
http://download.scientificlinux.net/ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
http://download.scientificlinux.net/ZendOptimizer-3.3.3-linux-glibc23-x86_64.tar.gz
http://download.scientificlinux.net/mysql-5.1.39-linux-i686-glibc23.tar.gz
http://download.scientificlinux.net/mysql-5.1.39-linux-x86_64-glibc23.tar.gz
2.在终端利用wget下载软件:
# cd /usr/local/src
# wget -i down.txt3、安装mysql
# cd /usr/local/src
# wget -i down.txt
# cd /usr/local/src
# tar zxvf mysql-5.1.39-linux-i686-glibc23.tar.gz
# mv mysql-5.1.39-linux-i686-glibc23 /usr/local/
# ln -s /usr/local/mysql-5.1.39-linux-i686-glibc23/ /usr/local/mysql
# groupadd mysql
# useradd -g mysql mysql
# chown -R mysql:mysql /usr/local/mysql
# chown -R mysql:mysql /usr/local/mysql-5.1.39-linux-i686-glibc23/
以上是“CentOS 5.3 + Nginx 0.7.x+ PHP 5.2.x+ MySQL 5.1.x服务器环境架[服务器安全]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |