安裝HTTPD服務
yum安裝httpd
yum -y install httpd httpd-devel
vim /etc/httpd/conf/httpd.conf
ServerName 127.0.0.1:80
#<=修改:大約在276行
vim /etc/httpd/conf.d/welcome.conf
添加如下内容:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/application/apache/html/blog"
ServerName blog.sdjx.org
ServerAlias sdjx.org
ErrorLog"/app/logs/blog-error_log"
CustomLog"/app/logs/blog-access_log" common
</VirtualHost>
mkdir -p /app/logs
mkdir -p /application/apache/html/blog
加入開機自啟動: chkconfig --levels 235httpd on
啟動服務:
apachectl start
測試:
echo "http://blog.sdjx.org" > /application/apache/html/blog/index.html
在windows做好解析:
C:\Windows\System32\drivers\etc
打開hosts檔案在最後一行添加:
192.168.146.15 blog.sdjx.org
在浏覽器中輸入:
http://blog.sdjx.org
顯示内容http://blog.sdjx.org表示搭建好了
資料庫安裝:
具體步驟詳見:http://zhanghongxin.blog.51cto.com/11255031/1847048
PHP安裝:
安裝依賴包:
mkdir -p /home/data/tools
cd /home/data/tools
yum -y install openssl openssl-devel curlcurl-devel libjpeg-turbo libjpeg-turbo-devel openjpeg-libs libpng libpng-develfreetype freetype-devel zlib-devel libxml2-devel libjpeg-devel libiconv-devel gd-devellibxslt-devel
wget
https://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
tar xf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure --prefix=/application/libmcrypt-2.5.8
make && make install
ln -s /application/libmcrypt-2.5.8 /usr/local/libmcrypt
PHP安裝包擷取位址:
wget
http://mirrors.sohu.com/php/php-5.3.28.tar.gz
tar xf php-5.3.28.tar.gz
cd php-5.3.28
./configure --prefix=/application/php-5.3.28/--with-config-file-path=/application/php-5.3.28/etc --with-apxs2=/usr/sbin/apxs--with-mysql=mysqlnd --with-mcrypt=/usr/local/libmcrypt --with-gd--with-openssl --with-zlib --enable-xml--with-xmlrpc --enable-session --with-iconv --enable-magic-quotes --with-curl--with-curlwrappers --enable-ctype --enable-bcmath --enable-shmop--enable-sysvsem --enable-inline-optimization --enable-mbregex --with-jpeg-dir --with-png-dir--with-freetype-dir --enable-gd-native-ttf --with-gettext --enable-mbstring --enable-pcntl --enable-soap --enable-sockets--enable-zip --enable-ftp
make && make install
ln -s /application/php-5.3.28 /usr/local/php
cp /home/data/tools/php-5.3.28/php.ini-development/application/php-5.3.28/etc/php.ini
vim /application/php-5.3.28/etc/php.ini
修改大約1008行:
date.timezone ="PRC"
vim /etc/httpd/conf/httpd.conf
修改大約305行:
AllowOverride All
修改大約332行:
Options -IndexesFollowSymLinks
修改大約403行:
DirectoryIndex index.php index.htmlindex.html.var
在大約781行AddType application/x-gzip .gz .tgz下添加一下内容:
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
cd /application/apache/html/blog
echo "<?php phpinfo(); ?>">index.php
apachectl –t
apachectl graceful