一宾肺、安裝配置mysql
# apt-get update
# apt-get install mysql-server ? //輸入兩次以設置mysql的root密碼 ? ubuntu默認安裝最新版本
# sudo mysql_install_db
# sudo mysql_secure_installation ? ? //輸入root密碼秃流,后續(xù)操作按一直 Enter 即可
如果要開啟mysql可本地遠程連接的話,執(zhí)行以下幾條命令:
# vi /etc/mysql/mysql.conf.d/mysqld.cnf? //編輯找到 bind-address 設置其值為 0.0.0.0? 然后保存 (或者注釋該行也行)
#?mysql -u root -p
# use mysql; ? ? //切換到mysql數(shù)據(jù)庫
#GRANT ALL PRIVILEGES ON . TO 'root'@'%'IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
#?FLUSH PRIVILEGES; ??
# exit;
# service mysql restart ? ?//重啟mysql
注意:要想mysql能夠遠程連接惯雳,要去阿里云配置一下安全組才能生效
二队橙、安裝Nginx
Ubuntu16.04有Nginx安裝包,我們可以安裝连躏。
# apt-get -y install nginx
三剩岳、安裝 PHP 7
# apt-get -y install php7.0-fpm
四、配置nginx
# sudo nano /etc/nginx/sites-available/default
server {
listen 80 default_server;
index index.php index.html index.htm;
location ~ \.php$ {
? try_files $uri /index.php =404;
? fastcgi_split_path_info ^(.+\.php)(/.+)$;
? fastcgi_pass unix:/run/php/php7.0-fpm.sock;
? fastcgi_index index.php;
? fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
# service nginx restart ? //重啟nginx
開啟端口:
五入热、上傳代碼
六拍棕、測試網(wǎng)站