在好友的推薦下購(gòu)買(mǎi)了QuickWeb的VPS,512 MB內(nèi)存,25 GB空間,500 GB流量,于是開(kāi)始折騰起來(lái)。
登陸后臺(tái),選擇安裝了CentOS 5.5 (32-bit),然后根據(jù)Linode的文檔安裝了LAMP。
SSH登陸你的VPS,一般用PuTTY,IP為你的VPS的IP,用戶(hù)名是root,密碼是郵件里的密碼。
AMP(Apache + MySql + PHP)網(wǎng)站服務(wù)器工作環(huán)境搭建
1、安裝/配置 Apache Web Server
1 2 | yum update yum install httpd |
備份 Apache 配置文件
1 | cp /etc/httpd/conf/httpd.conf ~/httpd.conf.backup |
配置虛擬主機(jī)
1 | vi /etc/httpd/conf.d/vhost.conf |
1 2 3 4 5 6 7 8 9 10 | NameVirtualHost 173.231.xxx.xxx:80 <VirtualHost domain.com:80> ServerAdmin domain@domain.com ServerName domain.com ServerAlias www.domain.com DocumentRoot /home/www/domain.com/public_html/ ErrorLog /srv/home/domain.com/logs/error.log CustomLog /srv/home/domain.com/logs/access.log combined </VirtualHost> |
創(chuàng)建文件夾
1 2 | mkdir -p /home/www/domain.com/public_html mkdir -p /home/www/domain.com/logs |
啟動(dòng)Apache
1 | /etc/init.d/httpd start |
配置設(shè)置為開(kāi)機(jī)啟動(dòng)
1 | /sbin/chkconfig --levels 235 httpd on |
重啟Apache
1 | /etc/init.d/httpd reload |
2、安裝/配置 MySQL
1 | yum install mysql-server |
配置設(shè)置為開(kāi)機(jī)啟動(dòng) :
1 | /sbin/chkconfig --levels 235 mysqld on |
啟動(dòng)/重啟 MySQL
1 | /etc/init.d/mysqld start |
配置MySQL / 建立數(shù)據(jù)庫(kù)
1 2 3 4 5 | mysql_secure_installation (注意修改密碼、刪除示例) mysql -u root -p (登入) create database DBNAME; (創(chuàng)建) grant all on DBNAME.* to 'DBUSER' identified by 'DBPASS'; (賦與權(quán)限 / 用戶(hù)名、密碼創(chuàng)建) quit (退出) |
3、安裝/配置 PHP
1 | yum install php php-pear |
配置PHP
1 | vi /etc/php.ini |
1 2 3 4 5 6 7 | error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR display_errors = Off log_errors = On error_log = /var/log/php.log max_execution_time = 300 memory_limit = 64M register_globals = Off |
安裝 PHP5-Mysql 包
1 | yum install php-mysql |
如需安裝FTP和PHPMYADMIN,可參考QuickWeb VPS之vsftpd,phpmyadmin安裝
還有數(shù)據(jù)備份QuickWeb VPS設(shè)置及數(shù)據(jù)備份