aliyun PHP Apache2 mysql 配置

aliyun 服务器从0 到1 配置开发手册

2018.10.11 购买最低配1核 512M  Ubuntu16.04 服务器从0 到1 开始配置

记录一下配置的每一步方便后面查阅

1.服务器PHP 服务配置

步骤一:更新apt

sudo apt-get update

步骤二:安装apache

sudo apt install apache2

步骤三:安装php7

sudo apt install php7.0

#php7.0 -v

PHP 7.0.32-0ubuntu0.16.04.1 (cli) ( NTS )

Copyright (c) 1997-2017 The PHP Group

Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies

    with Zend OPcache v7.0.32-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies

如果出现以上信息,则证明安装php7.0成功 整合一下php和apache

sudo apt install libapache2-mod-php7.0

步骤四:安装MySQL

sudo apt-get install mysql-server

步骤五:重启MySQL和Apache

  1. sudo service mysql restart
  2. sudo service apache2 restart

apache2 ssl 配置

sudo a2enmod ssl   //启用ssl模块

 

sudo apt-get install openssl  //安装openssl

/etc/apache2/sites-enabled/000-default.conf

<VirtualHost *:443>

ServerAdmin webmaster@unixmen1.local

ServerName  ssl.fnkeep.com

ServerAlias ssl.fnkeep.com

DocumentRoot /var/www/fnkeepssl

ErrorLog ${APACHE_LOG_DIR}/error.log

CustomLog ${APACHE_LOG_DIR}/access.log combined

<Location />

Order allow,deny

Allow from all

</Location>

LogLevel info

SSLEngine on

SSLProtocol TLSv1 TLSv1.1 TLSv1.2

SSLCipherSuite ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4

SSLCertificateFile cert/public.pem

SSLCertificateKeyFile cert/214298008990373.key

SSLCertificateChainFile cert/chain.pem

ErrorLog ${APACHE_LOG_DIR}/error.log

CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

远程登录mysql
MySQL>GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’ IDENTIFIED BY ‘yourpassword’ WITH GRANT OPTION; MySQL>FLUSH PRIVILEGES;

vim/etc/mysql/mysql.conf.d/mysqld.cnf

注销 #bind = 127.0.0.1

 

 

 

wordpress  rewrite 配置

 

a2enmod rewrite
sudo service apache2 restart


ubuntu 创建用户 root@worker:/home# useradd -r -m -s /bin/bash spark  root@worker:/home# passwd spark  Enter new UNIX password:   Retype new UNIX password:   passwd: password updated successfully  root@worker:/home# ls  kuku  spark  root@worker:/home# 加root sudo 权限

root@iZm5eddn3qllt2r7b5cpvvZ:/home#chmod u+w /etc/sudoers 

root@iZm5eddn3qllt2r7b5cpvvZ:/home# sudo vim /etc/sudoers

root@iZm5eddn3qllt2r7b5cpvvZ:/home# chmod u-w /etc/sudoers

Leave a Reply

Your email address will not be published. Required fields are marked *