我选择Ubuntu作为OS平台来中国体育彩票开奖我的php,wordpress和mysql。它给了我很多关于Linux的学习经验。这是我在51sec.org博客网站上工作时记录的许多步骤。

1.配置接口

欢迎使用Ubuntu 15.10(GNU / 的Linux 4.2.0-16-通用x86_64)


 * Documentation:  //help.ubuntu.com/


可以更新48个软件包。
37个更新是安全更新。


上次登录时间:2016年2月13日星期六20:16:03来自192.168.2.62
[电子邮件 protected]:〜$ cd / etc / network
[电子邮件 protected]:/ etc / network $ sudo vi接口
约翰的[sudo]密码: #此文件描述了系统上可用的网络接口
#以及如何激活它们。有关更多信息,请参见interfaces(5)。


源/etc/network/interfaces.d/*


#环回网络接口
自动搜索
iface lo inet回送


#主网络接口-使用DHCP 
自动eth0

iface eth0 inet dhcp


#secondart网络接口-使用静态IP地址
自动ens160
iface ens160 inet静态
地址192.168.2.22
网络掩码255.255.255.0
网关192.168.2.1
域名服务器8.8.8.8
~

~
[电子邮件 protected]:/ etc / network $sudo /etc/init.d/networking重新启动

2.系统软件更新

sudo apt-get更新        #获取可用更新列表
sudo apt-get升级      #严格升级当前软件包
须藤apt-get dist-upgrade  #中国体育彩票开奖更新(新的)


须藤纳米/etc/apache2/apache2.conf   #向以下内容的一行添加一行“ ServerName server_domain_or_IP” /etc/apache2/apache2.conf文件以禁止显示警告消息。 
须藤apache2ctl configtest
sudo 系统控制重新启动apache2

检查防火墙以确保允许80和443的入站流量

[电子邮件 protected]:〜$ sudo ufw应用程序列表
sudo:无法解析主机ip-10-10-0-60
可用的应用程序:
  Apache
  Apache Full
  Apache Secure
  OpenSSH
[电子邮件 protected]:〜$ sudo ufw应用程序信息“ Apache Full”
sudo:无法解析主机ip-10-10-0-60
资料:Apache Full
标题:Web服务器(HTTP,HTTPS)
描述:Apache v2是无所不在的Apache Web的下一代
服务器。


端口:
  80,443/tcp
[电子邮件 protected]:〜$ sudo ufw在“ Apache Full”中允许
sudo:无法解析主机ip-10-10-0-60
规则已更新
规则已更新(v6)
[电子邮件 protected]:〜$ sudo ufw应用程序信息“ Apache Full”
sudo:无法解析主机ip-10-10-0-60
资料:Apache Full
标题:Web服务器(HTTP,HTTPS)
描述:Apache v2是无所不在的Apache Web的下一代
服务器。


端口:

  80,443/tcp

[电子邮件 protected]:/ etc / network $ cat / etc / *-release
DISTRIB_ID = Ubuntu
DISTRIB_RELEASE = 15.10
DISTRIB_CODENAME =聪明
DISTRIB_DESCRIPTION =” Ubuntu 15.10”
NAME =“ Ubuntu”
VERSION =“ 15.10(Wily Werewolf)”
ID = ubuntu
ID_LIKE = debian
PRETTY_NAME =” Ubuntu 15.10”
VERSION_ID =” 15.10”
HOME_URL=”http://www.ubuntu.com/”
SUPPORT_URL=”http://help.ubuntu.com/”
BUG_REPORT_URL=”http://bugs.launchpad.net/ubuntu/”
[电子邮件 protected]:/ etc / network $ 

[电子邮件 protected]:/ etc / network $ 优名


的Linux ubuntu15 4.2.0-16-generic#19-Ubuntu SMP 10月8日星期四15:35:06 UTC 2015 x86_64 x86_64 x86_64 GNU / 的Linux


3.中国体育彩票开奖灯泡

3.1。中国体育彩票开奖Apache

要中国体育彩票开奖Apache,您必须中国体育彩票开奖Metapackage apache2。这可以通过在软件中心中搜索和中国体育彩票开奖,或运行以下命令来完成。

须藤apt-get install apache2



3.2。中国体育彩票开奖MySQL

要中国体育彩票开奖MySQL,您必须中国体育彩票开奖Metapackage mysql服务器。这可以通过在软件中心中搜索和中国体育彩票开奖,或运行以下命令来完成。
须藤apt-get install mysql服务器
须藤mysql_install_db
须藤mysql_secure_installation

 

 

3.3。中国体育彩票开奖PHP

要中国体育彩票开奖PHP,您必须中国体育彩票开奖Metapackages php5 and libapache2-mod-php5。这可以通过在软件中心中搜索和中国体育彩票开奖,或运行以下命令来完成。
须藤apt-get install php libapache2-mod-php php-mcrypt php-mysql

 

3.4。重新启动服务器

中国体育彩票开奖MySQL和PHP后,您的服务器应自动重新启动Apache。如果不是,请执行此命令。
sudo /etc/init.d/apache2重新启动

 

3.5。检查Apache

打开网络浏览器并导航到http://本地主机/。您应该看到一条消息说 有用!

3.6。检查PHP

您可以通过从内部执行任何PHP文件来检查PHP / var / www /。或者,您可以执行以下命令,这将使PHP无需编写文件即可运行代码。
[电子邮件 protected]:/ etc / network $ php -r‘echo“ \ n \ n您的PHP中国体育彩票开奖正常。\ n \ n \ n”;’


您的PHP中国体育彩票开奖正常。




[电子邮件 protected]:〜$的PHP-我


[电子邮件 protected]:〜$须藤纳米/var/www/html/info.php
<?php
phpinfo();
?>

http://your_server_IP_address/info.php

4.中国体育彩票开奖Phpmyadmin(可选)

$ sudo apt-get install phpmyadmin

按照配置向导完成配置,例如选择:

  • 您的Web服务器的apache2
  • 是的 使用dbconfig-common为phpmyadmin配置数据库?
  • phpmyadmin的MySQL应用程序密码:
  • 超级用户的密码 数据库管理用户的密码:

5.中国体育彩票开奖WordPress
5.1中国体育彩票开奖

cd ~
wget http://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
sudo apt-get update
sudo apt-get install php5-gd libssh2-php

5.2配置

[电子邮件 protected]:〜$ cd ~/wordpress
[电子邮件 protected]:~/wordpress$ cp wp-config-sample.php wp-config.php
[电子邮件 protected]:~/wordpress$ curl -s //api.wordpress.org/secret-key/1.1/salt/
define('AUTH_KEY',         '/c|BO/-!OU8+unm:*{r.iZD/7.Ayge],.Unawgno^!%([电子邮件 protected]#U7fdW#3Q<hcq<&/e');
define('SECURE_AUTH_KEY',  '5d;:+VIC&Lh6-F>IoYk6eQag=n,;/KB9^589o|Ou)_N-_yb;Bo7$t,}?Uc 4rtgO');
define('LOGGED_IN_KEY',    '=/lVrQ?h6yt(yYi9VS=1kZehJ67z4o]bg{dO-jIXl*r8h~3qeUd9BK6!3|#@;.!2');
define('NONCE_KEY',        'HuHK`7HwsW7|jvAXY(AXWFYcWmbvW2-xwNw[HXM0nu?4P.GATiYXZhLsAiaqoF<N');
define('AUTH_SALT',        '!qV`*1GT;dRH-Zf6Ylwa*I]]|Y/seeoHqc*-:N11xi.!<d8X|<bA`4ot-2oJrmNO');
define('SECURE_AUTH_SALT', '+TgB6l[^8LgLp65);+PtT2DYideMa>UD=SJZ2jD`[电子邮件 protected]>;i:X1JLU{`g');
define('LOGGED_IN_SALT',   'R`~Rhkuzz}v|OM|<$JSjkBd,~y/fsePw[q6:hH>GR{u``I/pmRa_]BkG%g(@K36x');
define('NONCE_SALT',       'C305sfDZGO5~J3XLDp|QLw2]4QYZ1B/#UM[pC6Lt+tvkBi]9pl-k^]e6Cw$,DM1(');
[电子邮件 protected]:~/wordpress$
[电子邮件 protected]:~/wordpress$ nano wp-config.php

5.3连接数据库
变更:

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');

/** MySQL database username */
define('DB_USER', 'wordpressuser');

/** MySQL database password */
define('DB_PASSWORD', 'password');

5.4将文件复制到/ var / www / html并更改权限

 

sudo rsync -avP ~/wordpress/ / var / www /html/
cd / var / www /html

sudo chown -R ubuntu:www-data *
mkdir / var / www /html/wp-content/uploads
sudo chown -R :www-data / var / www /html/wp-content/uploads

5.5 Web界面中国体育彩票开奖

6.允许远程WordPress连接到Mysql
6.1更改MySql绑定接口:

[电子邮件 protected]:/etc/mysql/mysql.conf.d$ netstat -ntlp | grep 3306
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      -               
[电子邮件 protected]:/etc/mysql/mysql.conf.d$ vi mysqld.cnf
.....
# Instead of skip-networking the default is now to listen 上 ly 上 
# localhost which is more compatible 和 is not less secure.
# bind-address          = 127.0.0.1
bind-address            = 0.0.0.0
#
.....

[电子邮件 protected]:/etc/mysql/mysql.conf.d$ sudo /etc/init.d/mysql restart
sudo: unable to resolve host ip-10-1-1-50
Restarting mysql (via 系统控制): mysql.service.
[电子邮件 protected]:/etc/mysql/mysql.conf.d$ netstat -ntlp | grep 3306
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      -   

6.2允许具有远程计算机名称或公共IP的新用户访问Mysql DB

[电子邮件 protected]:/etc/mysql/mysql.conf.d$ sudo mysql -u root -p mysql
sudo: unable to resolve host ip-10-1-1-50
Enter password: 
Reading table information for completion of table 和 column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 74
Server version: 5.7.19-0ubuntu0.16.04.1 (Ubuntu)

Copyright (c) 2000, 2017, Oracle 和/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation 和/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql> create user 'remotewordpressuser'@'ec2-34-215-22-243.us-west-2.compute.amazonaws.com' identified by '1234567890';
ERROR 1396 (HY000): Operation CREATE USER failed for 'remoteuser'@'ec2-34-215-22-243.us-west-2.compute.amazonaws.com'


mysql> GRANT ALL ON *.* to [电子邮件 protected]'ec2-34-215-22-243.us-west-2.compute.amazonaws.com' identified by '1234567890';
Query OK, 0 rows affected, 1 warning (0.00 sec)


mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> exit
Bye
[电子邮件 protected]:/etc/mysql/mysql.conf.d$ 







[[电子邮件 protected] html]# mysql -h 50.40.50.80 -u remotewordpressuser -p
Enter password: 
ERROR 1130 (HY000): Host 'ec2-34-215-22-243.us-west-2.compute.amazonaws.com' is not allowed to connect to this MySQL server
[[电子邮件 protected] html]# 
[[电子邮件 protected] html]# mysql -h 50.40.50.80 -u remotewordpressuser -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 82
Server version: 5.7.19-0ubuntu0.16.04.1 (Ubuntu)

Copyright (c) 2000, 2017, Oracle 和/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation 和/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 









[[电子邮件 protected] html]# cp wp-config.php wp-config.php.old
[[电子邮件 protected] html]# vi wp-config.php

<?php
/**
 * The base configuration for WordPress
 *
 * The wp-config.php creation script uses this file during the
 * installation. You don't have to use the web site, you can
 * copy this file to "wp-config.php" 和 fill in the values.
 *
 * This file contains the following configurations:
 *
 * * MySQL settings
 * * Secret keys
 * * Database table prefix
 * * ABSPATH
 *
 * @link //codex.wordpress.org/Editing_wp-config.php
 *
 * @package WordPress
 */

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');

/** MySQL database username */
define('DB_USER', 'remotewordpressuser');

/** MySQL database password */
define('DB_PASSWORD', '1234567890');

/** MySQL hostname */
define('DB_HOST', '50.40.50.80');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8mb4');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

/**#@+



注意:
一种。停止Mysql服务并在重新启动时禁用自动运行

[电子邮件 protected]:/var/log/apache2$ vmstat -s
      1014648 K total memory
       310308 K used memory
       390732 K active memory
       143836 K inactive memory
       414364 K free memory
        15576 K buffer memory
       274400 K swap cache
            0 K total swap
            0 K used swap
            0 K free swap
          675 non-nice user cpu ticks
            0 nice user cpu ticks
          608 system cpu ticks
       157804 idle cpu ticks
         1517 IO-wait cpu ticks
            0 IRQ cpu ticks
           15 softirq cpu ticks
          527 stolen cpu ticks
       205823 pages paged in
        23372 pages paged out
            0 pages swapped in
            0 pages swapped out
        97824 interrupts
       160060 CPU context switches
   1506783521 boot time
         1623 forks
[电子邮件 protected]:/var/log/apache2$ sudo 服务 mysql stop
sudo: unable to resolve host ip-10-10-0-55
[电子邮件 protected]:/var/log/apache2$ vmstat -s
      1014648 K total memory
       154184 K used memory
       235852 K active memory
       132412 K inactive memory
       581604 K free memory
        15648 K buffer memory
       263212 K swap cache
            0 K total swap
            0 K used swap
            0 K free swap
          696 non-nice user cpu ticks
            0 nice user cpu ticks
          612 system cpu ticks
       167728 idle cpu ticks
         1523 IO-wait cpu ticks
            0 IRQ cpu ticks
           15 softirq cpu ticks
          528 stolen cpu ticks
       207123 pages paged in
        23868 pages paged out
            0 pages swapped in
            0 pages swapped out
       101681 interrupts
       167164 CPU context switches
   1506783521 boot time
         1657 forks
[电子邮件 protected]:/var/log/apache2$ sudo nano /etc/init/mysql.conf
sudo: unable to resolve host ip-10-10-0-55

  GNU nano 2.5.3                                                     File: /etc/init/mysql.conf                                                                                                                

description     "MySQL 5.7 Server"
author          "Mario Limonciello <[电子邮件 protected]>"

#start 上  runlevel [2345]
stop 上  starting rc RUNLEVEL=[016]

respawn
respawn limit 2 5

env HOME=/etc/mysql
umask 007

# The default of 5 seconds is too low for mysql which needs to flush buffers
kill timeout 300

b。停止Apache2服务,并在重新启动后禁用自动运行

  1. 系统控制 命令–仅适用于基于systemd的Ubuntu 版本16.04 LTS及以上.
  2. /etc/init.d/apache2 –用于在Debian或Ubuntu 的Linux下启动/停止/重新启动Apache2服务的sys v init样式脚本。
  3. 服务 命令–该命令在 大多数Linux发行版 包括Debian和Ubuntu。
  4. 暴发户 命令–仅适用于 某些版本的Ubuntu.
  5. apache2ctl 命令–此方法应 在所有Linux和Unix上都能正常工作操作系统。
$ lsb_release -a
$ sudo 系统控制 stop apache2.service
$ sudo 系统控制 status apache2.service



$ sudo apt-get install rcconf
$ sudo rcconf

7.中国体育彩票开奖免费的https证书 
//letsencrypt.org/ 为使用以下功能的流行应用程序平台提供免费的ssl / tls证书 Certbot ACME客户端 简化整个过程。

$ sudo apt-get更新
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:certbot/certbot
$ sudo apt-get更新
$ sudo apt-get install python-certbot-apache 



$ sudo certbot --apache

参考:

通过 约翰

发表评论