$ sudo apt-get update -y $ sudo apt-get install apache2 -y $ sudo systemctl start apache2.service
$ sudo apt-get install mysql-server -y $ sudo /usr/bin/mysql_secure_installation ## 都選y就行 $ mysql -u root -p mysql> CREATE DATABASE js_website; ## 導入數據 mysql> source /tmp/jskj.sql; mysql> \q;
$ sudo apt-get install php -y; $ sudo apt-get install -y php-{bcmath,bz2,intl,gd,mbstring,mcrypt,mysql,zip} && sudo apt-get install libapache2-mod-php -y;
$ mkdir /var/www/html/phpcms $ cd /var/www/html/phpcms # 上傳phpcms.zip包至此目錄 $ unzip phpcms.zip $ ls -l drwxr-xr-x 11 root root 4096 Jun 24 17:21 ./ drwxr-xr-x 3 root root 4096 Jun 24 17:21 ../ -rw-r--r-- 1 root root 48 Jun 24 15:53 admin.php drwxr-xr-x 3 root root 4096 Jun 24 15:53 api/ -rw-r--r-- 1 root root 991 Jun 24 15:53 api.php drwxr-xr-x 18 root root 4096 Jun 24 15:53 caches/ -rw-r--r-- 1 root root 104 Jun 24 15:53 crossdomain.xml drwxr-xr-x 6 root root 4096 Jun 24 15:53 custom/ -rw-r--r-- 1 root root 3158 Jun 24 15:53 favicon.ico drwxr-xr-x 2 root root 4096 Jun 24 15:53 html/ -rw-r--r-- 1 root root 4444 Jun 24 15:53 index.htm -rw-r--r-- 1 root root 22758 Jun 24 15:53 index.html -rw-r--r-- 1 root root 318 Jun 24 15:53 index.php -rw-r--r-- 1 root root 523 Jun 24 15:53 js.html drwxr-xr-x 8 root root 4096 Jun 24 15:53 mes/ drwxr-xr-x 8 root root 4096 Jun 24 15:53 phpcms/ -rw-r--r-- 1 root root 168191200 Jun 24 16:38 phpcms.zip drwxr-xr-x 7 root root 4096 Jun 24 15:53 phpsso_server/ -rw-r--r-- 1 root root 3621 Jun 24 15:53 plugin.php -rw-r--r-- 1 root root 170 Jun 24 15:53 robots.txt drwxr-xr-x 6 root root 4096 Jun 24 15:53 statics/ drwxr-xr-x 4 root root 4096 Jun 24 15:53 uploadfile/
👉這裏的zip壓縮包,是已經install後的phpcms,由於項目經理給個人就是安裝好的,因此就直接用了。php
反正原理都同樣,配置Apache解析域名指向路徑就行。html
$ cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/phpcms.conf $ cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/phpcms-mes.conf $ ln -s /etc/apache2/sites-available/phpcms.conf /etc/apache2/sites-enabled/phpcms.conf $ ln -s /etc/apache2/sites-available/phpcms-mes.conf /etc/apache2/sites-enabled/phpcms-mes.conf $ vim /etc/apache2/sites-available/phpcms.conf ServerName js.dbpe-cps.com # ServerAdmin webmaster@localhost DocumentRoot /var/www/html/phpcms $ vim /etc/apache2/sites-available/phpcms-mes.conf ServerName mes.js.dbpe-cps.com # ServerAdmin webmaster@localhost DocumentRoot /var/www/html/phpcms/mes $ service apache2 restart
配置你的域名指向你的服務器就行。這裏略過。mysql
## 重啓Apache2 $ service apache2 restart $ service apache2 status $ service apache2 start
/etc/apache2
/var/www/html
這一點跟其餘的不同,我也是看到配置文件才知道是這個目錄的web
/etc/apache2/apache2.confsql