sudo apt-get install apache2
安裝完成後,瀏覽器訪問http://your ip/
,出現It works!
網頁表示安裝成功。php
service apache2 status|start|stop|restart
/var/www/
sudo chmod 777 /var/www
/etc/apache2/
/etc/apache2/apache2.conf
/etc/apache2/ports.conf
/etc/apache2/sites-enabled/000-default.conf
sudo apt-get install mariadb-server mariadb-client
sudo systemctl start mysql
sudo systemctl status mysql
service mysql restart
netstat -tunpl 或 netstat -tap
sudo mysql_secure_installation
爲NextCloud建立數據庫和用戶
建立數據庫nextcloud
,用戶名nextcloud
,密碼XXXXXXXX
html
sudo mysql -u root -p
進入MariaDB後,執行:mysql
#建立數據庫,名爲:nextcloud CREATE DATABASE nextcloud; GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost' IDENTIFIED BY 'XXXXXXXX'; FLUSH PRIVILEGES; #退出 \q
sudo apt-get install php7.0 sudo apt-get install apache2 mariadb-server libapache2-mod-php7.0 sudo apt-get install php7.0-gd php7.0-json php7.0-mysql php7.0-curl php7.0-mbstring sudo apt-get install php7.0-intl php7.0-mcrypt php-imagick php7.0-xml php7.0-zip
php7.0 -v
執行sudo nano /var/www/html/phpinfo.php 文件中寫:<?php echo phpinfo();?> 瀏覽器訪問:http://your ip/phpinfo.php,出現PHP Version網頁
sudo apt-get install phpmyadmin
sudo ln -s /usr/share/phpmyadmin /var/www/html
sudo a2enmod rewrite
service php7.0-fpm restart & service apache2 restart
http://your ip/phpmyadmin
nano /etc/apache2/apache2.conf
在最後面添加:web
AddType application/x-httpd-php .php .htm .html AddDefaultCharset UTF-8
而後重啓Apache服務。
到此爲止,web站點其實已經搭建起來了,只需在/var/www/html
目錄下存放網頁文件,電腦主機就能夠訪問服務器了,http://ip/xxx.html
。sql
cd /var/www/html wget https://download.nextcloud.com/server/releases/nextcloud-15.0.7.zip unzip nextcloud-15.0.7.zip rm nextcloud-15.0.7.zip
接下來只須要在電腦主機的瀏覽器上輸入http://ip/nextcloud,就能夠正常訪問了。數據庫
若是出現下面的畫面,說明你沒有給nextcloud目錄權限:apache
解決方法:json
cd /var/www/html chown www-data nextcloud -Rf chmod 770 nextcloud -Rf
解決方法:瀏覽器
sudo apt-get install libcurl3 php7.0-curl
暫時遇到這麼多問題,等之後遇到新的問題再補充~~~安全
參考博文:https://www.jianshu.com/p/44f86003ac37