Ubuntu 搭建phpcms

安装Apache2

$ sudo apt-get update -y
$ sudo apt-get install apache2 -y
$ sudo systemctl start apache2.service

安装Mysql

$ 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;

安装PHP

$ 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;

部署PHP官网

$ 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,因为项目经理给我的就是安装好的,所以就直接用了。

反正原理都一样,配置Apache解析域名指向路径就行。

配置Apache

$ 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

域名解析

配置你的域名指向你的服务器就行。这里略过。

其他

Apache常用命令

## 重启Apache2
$ service apache2 restart 
$ service apache2 status
$ service apache2 start

Apache目录

  • 配置目录:/etc/apache2
  • 默认www目录:/var/www/html

这一点跟其他的不一样,我也是看到配置文件才知道是这个目录的

/etc/apache2/apache2.conf

posted @ 2020-02-10 19:46  进击的阿晨  阅读(540)  评论(0编辑  收藏  举报