您好![請(qǐng)登陸] [免費(fèi)注冊(cè)] [忘記密碼]
申請(qǐng)加盟    銷售熱線: 020-85421558 技術(shù)支持: 020-36523071 備案專線: (0)136-8886-2121

你要找的是深圳虛擬主機(jī)哪家好?中外商貿(mào)為你提供服務(wù):深圳虛擬主機(jī)價(jià)格、深圳虛擬主機(jī)公司,歡迎瀏覽:深圳虛擬主機(jī)

深圳虛擬主機(jī)
系統(tǒng)約定
軟件源代碼包存放位置 /usr/local/src 
源碼包編譯安裝位置(prefix) /usr/local/Comsenz/software_name 
腳本以及維護(hù)程序存放位置 /usr/local/Comsenz/sbin 
MySQL 數(shù)據(jù)庫位置 /data/mysql(可按情況設(shè)置) 
Apache 網(wǎng)站根目錄 /data/wwwroot(可按情況設(shè)置) 
Apache 虛擬主機(jī)日志根目錄 /data/wwwroot/logs(可按情況設(shè)置) 
Apache 運(yùn)行賬戶 www:www 


相關(guān)推薦:PHP5.4+Apache+Mysql 服務(wù)器環(huán)境配置


系統(tǒng)環(huán)境初始化
1、檢查系統(tǒng)是否正常
more /var/log/messages(檢查有無系統(tǒng)級(jí)錯(cuò)誤信息)


dmesg (檢查硬件設(shè)備是否有錯(cuò)誤信息)


cat /proc/cpuinfo (檢查CPU頻率是否正常)


top (按1檢測(cè)CPU核數(shù)是否正常,內(nèi)存大小是否正常)


ifconfig(檢查網(wǎng)卡設(shè)置是否正確)


ping www.163.com(檢查網(wǎng)絡(luò)是否正常)


2、關(guān)閉不需要的服務(wù)
ntsysv


以下僅列出需要啟動(dòng)的服務(wù),未列出的服務(wù)一律推薦關(guān)閉:


atd


crond


irqbalance


microcode_ctl


network


sendmail


sshd


syslog


關(guān)閉SElinux:


修改/etc/selinux/config文件中的SELINUX= 為 disabled


3、更換快速源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.old


cd /etc/yum.repos.d/


wget http://c.sihost.net/CentOS-Base-sohu.repo


mv CentOS-Base-sohu.repo CentOS-Base.repo


yum clean


yum -y update


lsb_release -a


yum -y erase mysql


yum -y erase php


yum -y erase httpd


4、使用 yum 程序安裝所需開發(fā)包(以下為標(biāo)準(zhǔn)的 RPM 包名稱)
yum -y install ntp make openssl openssl-devel pcre pcre-devel libpng libpng-devel libtiff-devel libjpeg-6b libjpeg-devel-6b freetype freetype-devel gd gd-devel fontconfig-devel zlib zlib-devel libevent-devel gcc gcc-c++ flex bison bzip2-devel libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 curl curl-devel


5、定時(shí)校正服務(wù)器時(shí)鐘,定時(shí)與中國國家授時(shí)中心授時(shí)服務(wù)器同步
crontab –e


加入一行:


*/30 * * * * ntpdate 210.72.145.44 > /dev/null 2>&1


6、下載程序包
Apache


推薦穩(wěn)定版 2.2.21


http://archive.apache.org/dist/httpd/


PHP


推薦穩(wěn)定版5.2.17


http://cn.php.net/downloads.php


Mysql


推薦穩(wěn)定版5.5.18


http://www.mysql.com/downloads/mysql/


文中的配置文件和腳本限于篇幅,請(qǐng)到以下地址下載(僅支持linux下使用wget下載)


Apache控制腳本


http://c.sihost.net/jb/httpd


Apache配置文件


http://c.sihost.net/jb/httpd.conf


以上列出的程序最新推薦版下載列表


http://c.sihost.net/lamp_tools.list


在 /usr/local/src目錄下執(zhí)行


wget http://c.sihost.net/lamp_tools.list


wget -i lamp_tools.list


7、創(chuàng)建web運(yùn)行用戶
groupadd www


useradd -g www www


mkdir -p /data/wwwroot


chmod +w /data/wwwroot


chown www:www /data/wwwroot -R


8、重新啟動(dòng)
init 6


編譯安裝環(huán)境
1、安裝 MySQL
cd /usr/local/src


tar zxvf cmake-2.8.5.tar.gz


cd cmake-2.8.5/


./configure


gmake &&gmake install 


groupadd mysql


useradd -g mysql mysql


mkdir -p /data/mysql


chown -R mysql:mysql /data/mysql


cd /usr/local/src


tar zxvf mysql-5.5.18.tar.gz


cd mysql-5.5.18


cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/Comsenz/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/usr/local/Comsenz/etc/ -DWITH_BLACKHOLE_STORAGE_ENGINE=1


make && make install


cd /usr/local/Comsenz/mysql


./scripts/mysql_install_db --user=mysql


cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld


chmod 755 /etc/rc.d/init.d/mysqld


chkconfig --add mysqld


chkconfig --level 3 mysqld on


編輯/etc/rc.d/init.d/mysqld


找到


basedir=


datadir=


改成


basedir=/usr/local/Comsenz/mysql


datadir=/data/mysql


然后


mkdir -p /usr/local/Comsenz/etc


cp ./support-files/my-huge.cnf /usr/local/Comsenz/etc/my.cnf


編輯/usr/local/Comsenz/etc/my.cnf


在 [mysqld] 段增加


datadir = /data/mysql


wait-timeout = 10


max_connections = 512


max_connect_errors = 10000000


local-infile=0


在 [mysqld] 段修改


max_allowed_packet = 16M


thread_cache_size = CPU個(gè)數(shù)*2


將 log-bin 注釋


mv /usr/local/Comsenz/mysql/data/* /data/mysql


service mysqld start


bin/mysqladmin -u root password 'admin999'


其中admin999是要設(shè)置的root密碼


2、安裝 Apache
cd /usr/local/src/


tar zxvf httpd-2.2.21.tar.gz


cd httpd-2.2.21


./configure --prefix=/usr/local/Comsenz/apache --enable-module=rewrite --disable-access --disable-auth --disable-charset-lite --disable-include --disable-log-config --disable-env --disable-setenvif --disable-mime --disable-status --disable-autoindex --disable-asis --disable-cgid --disable-cgi --disable-negotiation --disable-dir --disable-actions --disable-userdir --disable-alias --enable-so --enable-mods-shared='access auth auth_anon auth_dbm auth_digest dav dav_fs actions alias asis autoindex cache cern_meta cgi charset_lite deflate dir disk_cache env expires file_cache headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias'


make && make install


cd /usr/local/src/


mv /usr/local/Comsenz/apache/conf/httpd.conf /usr/local/Comsenz/apache/conf/httpd.conf.old


cp -f /usr/local/src/httpd.conf /usr/local/Comsenz/apache/conf/httpd.conf


cp -f /usr/local/src/httpd /etc/init.d/httpd


chmod 755 /etc/init.d/httpd


chkconfig --add httpd


chkconfig httpd on


3、編譯安裝PHP 所需的支持庫
tar zxvf libiconv-1.14.tar.gz


cd libiconv-1.14/


./configure --prefix=/usr/local


make && make install


cd /usr/local/src/


tar zxvf libmcrypt-2.5.8.tar.gz


cd libmcrypt-2.5.8


./configure


make && make install


/sbin/ldconfig


cd libltdl/


./configure --enable-ltdl-install


make && make install


cd /usr/local/src/


tar zxvf mhash-0.9.9.9.tar.gz


cd mhash-0.9.9.9/


./configure


make && make install


cd /usr/local/src/


64bit系統(tǒng)執(zhí)行下面的:


ln -s /usr/local/lib/libmcrypt.la /usr/lib64/libmcrypt.la


ln -s /usr/local/lib/libmcrypt.so /usr/lib64/libmcrypt.so


ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4


ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8


ln -s /usr/local/lib/libmhash.a /usr/lib64/libmhash.a


ln -s /usr/local/lib/libmhash.la /usr/lib64/libmhash.la


ln -s /usr/local/lib/libmhash.so /usr/lib64/libmhash.so


ln -s /usr/local/lib/libmhash.so.2 /usr/lib64/libmhash.so.2


ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1


ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config


ln -s /usr/local/lib/libiconv.so.2 /usr/lib64/libiconv.so.2


32bit系統(tǒng)執(zhí)行下面的:


ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la


ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so


ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4


ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8


ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a


ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la


ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so


ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2


ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1


ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config


ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2


tar zxvf mcrypt-2.6.8.tar.gz


cd mcrypt-2.6.8


/sbin/ldconfig


./configure


make && make install


4、編譯安裝PHP
cd /usr/local/src


tar zxvf php-5.2.17.tar.gz


cd php-5.2.17


./configure --prefix=/usr/local/Comsenz/php5 --with-config-file-path=/usr/local/Comsenz/etc --enable-mbstring --enable-ftp --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --enable-magic-quotes --with-mysql=/usr/local/Comsenz/mysql --with-pear --enable-sockets --with-ttf --with-freetype-dir=/usr --enable-gd-native-ttf --with-zlib --enable-sysvsem --enable-exif --enable-sysvshm --with-libxml-dir=/usr --with-apxs2=/usr/local/Comsenz/apache/bin/apxs --with-iconv=/usr/local/libiconv --with-iconv-dir=/usr/local --with-xmlrpc --enable-xml --enable-shmop --enable-zip --with-mhash --with-mcrypt --enable-discard-path --enable-bcmath --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --with-openssl


make &&make install


./libtool --finish /usr/local/src/php-5.2.17/libs


cp php.ini-dist /usr/local/Comsenz/etc/php.ini


echo 'ulimit -SHn 65535' >> /etc/rc.local


5、安裝PHP擴(kuò)展模塊(需要此功能的Discuz! X用戶選裝)
APC


cd /usr/local/src


tar zxvf APC-3.1.9.tgz


cd APC-3.1.9


/usr/local/Comsenz/php5/bin/phpize


./configure --enable-apc --enable-mmap --enable-apc-spinlocks --disable-apc-pthreadmutex --with-php-config=/usr/local/Comsenz/php5/bin/php-config


make &&make install


編輯/usr/local/Comsenz/etc/php.ini


查找


extension_dir = 


在下面一行添加


extension_dir = "/usr/local/Comsenz/php5/lib/php/extensions/no-debug-non-zts-20060613/"


extension="apc.so"


apc.enabled = 1


apc.shm_size = 64M


apc.stat = 1


保存


6、查看確認(rèn)L.A.M.P環(huán)境信息、提升 PHP 安全性
保存以下內(nèi)容為info.php到/data/www/,檢查phpinfo中的各項(xiàng)信息是否正確。




phpinfo();


?>


確認(rèn) PHP 能夠正常工作后,編輯/usr/local/Comsenz/etc/php.ini進(jìn)行設(shè)置提升PHP安全性。


查找


disable_functions =


修改成


disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,escapeshellcmd,escapeshellarg,shell_exec,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,leak,popepassthru,stream_socket_server,popen


然后


service httpd restart

 

 

備案系統(tǒng)認(rèn)證 舉報(bào)不良網(wǎng)站 我們的支付方式 AAA級(jí)信用
廣州萬戶網(wǎng)絡(luò)信息科技有限公司 旗下網(wǎng)站建設(shè)品牌:中外商貿(mào) moderntrendboss.com 版權(quán)所有 ©2000-2019 All Rights Reserved
網(wǎng)站備案編號(hào):粵ICP備15049595號(hào) 地址:廣州市番禺區(qū)大石街北聯(lián)圍仔工業(yè)路2號(hào)E座305
電話:020-85421558   傳真:020-88140140   郵編:510515
交換PR>=4的友情鏈接合作站,歡迎同行聯(lián)系鏈接QQ: