自己搭建网站笔记

教程地址

搭建网站实践:

  • 命令
wget http://soft.vpser.net/lnmp/lnmp1.4.tar.gz
tar -zxvf lnmp1.4.tar.gz
cd lnmp1.4
./install.sh

cd /home/wwwroot/
mv default old
wget https://cn.wordpress.org/wordpress-4.9-zh_CN.tar.gz
tar -zxvf wordpress-4.9-zh_CN.tar.gz
mv wordpress default
chown -R 755 /home/wwwroot
chown -R www:www /home/wwwroot
mysql -u root -p
  • 搭建站点
danyue:~ yuedan$ ssh [email protected]
[email protected]'s password: 
Last login: Wed Nov 22 19:06:09 2017 from 219.143.146.218
[root@vultr ~]# wget http://soft.vpser.net/lnmp/lnmp1.4.tar.gz
--2017-11-23 15:12:45--  http://soft.vpser.net/lnmp/lnmp1.4.tar.gz
正在解析主机 soft.vpser.net... 45.34.93.228, 2600:3c01::f03c:91ff:fe92:1a06
正在连接 soft.vpser.net|45.34.93.228|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:136988 (134K) [application/octet-stream]
正在保存至: “lnmp1.4.tar.gz”

100%[====================>] 136,988     --.-K/s   in 0.1s    

2017-11-23 15:12:45 (1.34 MB/s) - 已保存 “lnmp1.4.tar.gz” [136988/136988])

[root@vultr ~]# tar -zxvf lnmp1.4.tar.gz
lnmp1.4/
lnmp1.4/conf/
lnmp1.4/conf/enable-php5.4.conf
lnmp1.4/conf/enable-lnmpa-ssl-vhost-example.conf
lnmp1.4/conf/php-fpm5.2.conf
lnmp1.4/conf/pure-ftpd.conf
lnmp1.4/conf/enable-php7.0.conf
lnmp1.4/conf/httpd22-lnmpa.conf
lnmp1.4/conf/lnmp
lnmp1.4/conf/lamp
lnmp1.4/conf/proxy.conf
lnmp1.4/conf/enable-ssl-example.conf
lnmp1.4/conf/httpd-default.conf
lnmp1.4/conf/config.inc.php
lnmp1.4/conf/pathinfo.conf
lnmp1.4/conf/httpd24-lnmpa.conf
lnmp1.4/conf/memcached2.php
lnmp1.4/conf/httpd22-ssl.conf
lnmp1.4/conf/httpd-vhosts-lamp.conf
lnmp1.4/conf/proxy-pass-php.conf
lnmp1.4/conf/index.html
lnmp1.4/conf/lnmpa
lnmp1.4/conf/enable-php.conf
lnmp1.4/conf/httpd24-ssl.conf
lnmp1.4/conf/enable-php5.2.conf
lnmp1.4/conf/enable-php5.6.conf
lnmp1.4/conf/mod_remoteip.conf
lnmp1.4/conf/httpd24-lamp.conf
lnmp1.4/conf/enable-php5.5.conf
lnmp1.4/conf/memcached1.php
lnmp1.4/conf/ocp.php
lnmp1.4/conf/httpd-vhosts-lnmpa.conf
lnmp1.4/conf/CentOS-Base-163.repo
lnmp1.4/conf/enable-php-pathinfo.conf
lnmp1.4/conf/httpd22-lamp.conf
lnmp1.4/conf/nginx.conf
lnmp1.4/conf/enable-php7.1.conf
lnmp1.4/conf/rewrite/
lnmp1.4/conf/rewrite/wordpress.conf
lnmp1.4/conf/rewrite/thinkphp.conf
lnmp1.4/conf/rewrite/discuzx2.conf
lnmp1.4/conf/rewrite/typecho2.conf
lnmp1.4/conf/rewrite/sablog.conf
lnmp1.4/conf/rewrite/phpwind.conf
lnmp1.4/conf/rewrite/laravel.conf
lnmp1.4/conf/rewrite/discuzx.conf
lnmp1.4/conf/rewrite/dabr.conf
lnmp1.4/conf/rewrite/shopex.conf
lnmp1.4/conf/rewrite/drupal.conf
lnmp1.4/conf/rewrite/none.conf
lnmp1.4/conf/rewrite/discuz.conf
lnmp1.4/conf/rewrite/codeigniter.conf
lnmp1.4/conf/rewrite/ecshop.conf
lnmp1.4/conf/rewrite/typecho.conf
lnmp1.4/conf/rewrite/wp2.conf
lnmp1.4/conf/rewrite/dedecms.conf
lnmp1.4/conf/301.conf
lnmp1.4/conf/lnmp.gif
lnmp1.4/conf/nginx_a.conf
lnmp1.4/conf/enable-php5.3.conf
lnmp1.4/conf/enable-apache-ssl-vhost-example.conf
lnmp1.4/include/
lnmp1.4/include/ionCube.sh
lnmp1.4/include/mariadb.sh
lnmp1.4/include/memcached.sh
lnmp1.4/include/upgrade_mariadb.sh
lnmp1.4/include/upgrade_php.sh
lnmp1.4/include/init.sh
lnmp1.4/include/imageMagick.sh
lnmp1.4/include/version.sh
lnmp1.4/include/xcache.sh
lnmp1.4/include/only.sh
lnmp1.4/include/redis.sh
lnmp1.4/include/mysql.sh
lnmp1.4/include/apcu.sh
lnmp1.4/include/end.sh
lnmp1.4/include/multiplephp.sh
lnmp1.4/include/php.sh
lnmp1.4/include/nginx.sh
lnmp1.4/include/upgrade_mysql.sh
lnmp1.4/include/upgrade_nginx.sh
lnmp1.4/include/upgrade_phpmyadmin.sh
lnmp1.4/include/upgrade_mysql2mariadb.sh
lnmp1.4/include/eaccelerator.sh
lnmp1.4/include/apache.sh
lnmp1.4/include/main.sh
lnmp1.4/include/opcache.sh
lnmp1.4/upgrade.sh
lnmp1.4/uninstall.sh
lnmp1.4/init.d/
lnmp1.4/init.d/init.d.redis
lnmp1.4/init.d/init.d.fail2ban
lnmp1.4/init.d/init.d.httpd
lnmp1.4/init.d/init.d.memcached
lnmp1.4/init.d/init.d.pureftpd
lnmp1.4/init.d/init.d.php-fpm5.2
lnmp1.4/init.d/init.d.nginx
lnmp1.4/install.sh
lnmp1.4/pureftpd.sh
lnmp1.4/README
lnmp1.4/ChangeLog
lnmp1.4/lnmp.conf
lnmp1.4/License
lnmp1.4/src/
lnmp1.4/src/patch/
lnmp1.4/src/patch/debian_patches_disable_SSLv2_for_openssl_1_0_0.patch
lnmp1.4/src/patch/php-5.2.17-xml.patch
lnmp1.4/src/patch/php-5.3-multipart-form-data.patch
lnmp1.4/src/patch/mod_remoteip.c
lnmp1.4/src/patch/mysql-5.5-fix-arm-client_plugin.patch
lnmp1.4/src/patch/php-5.2.17-max-input-vars.patch
lnmp1.4/src/patch/libiconv-glibc-2.16.patch
lnmp1.4/src/patch/php-5.2-multipart-form-data.patch
lnmp1.4/upgrade1.x-1.4.sh
lnmp1.4/tools/
lnmp1.4/tools/backup.sh
lnmp1.4/tools/check502.sh
lnmp1.4/tools/cut_nginx_logs.sh
lnmp1.4/tools/reset_mysql_root_password.sh
lnmp1.4/tools/remove_open_basedir_restriction.sh
lnmp1.4/tools/denyhosts.sh
lnmp1.4/tools/remove_disable_function.sh
lnmp1.4/tools/denyhosts_removeip.sh
lnmp1.4/tools/fail2ban.sh
lnmp1.4/addons.sh
[root@vultr ~]# cd lnmp1.4
[root@vultr lnmp1.4]# ./install.sh

+------------------------------------------------------------------------+
|          LNMP V1.4 for CentOS Linux Server, Written by Licess          |
+------------------------------------------------------------------------+
|        A tool to auto-compile & install LNMP/LNMPA/LAMP on Linux       |
+------------------------------------------------------------------------+
|           For more information please visit https://lnmp.org           |
+------------------------------------------------------------------------+
You have 5 options for your DataBase install.
1: Install MySQL 5.1.73
2: Install MySQL 5.5.56 (Default)
3: Install MySQL 5.6.36
4: Install MySQL 5.7.18
5: Install MariaDB 5.5.56
6: Install MariaDB 10.0.30
7: Install MariaDB 10.1.23
0: DO NOT Install MySQL/MariaDB
Enter your choice (1, 2, 3, 4, 5, 6, 7 or 0): 2
You will install MySQL 5.5.56
===========================
Please setup root password of MySQL.(Default password: root)
Please enter: 123qwe
MySQL root password: 123qwe
===========================
Do you want to enable or disable the InnoDB Storage Engine?
Default enable,Enter your choice [Y/n]: 
No input,The InnoDB Storage Engine will enable.
===========================
You have 6 options for your PHP install.
1: Install PHP 5.2.17
2: Install PHP 5.3.29
3: Install PHP 5.4.45
4: Install PHP 5.5.38 (Default)
5: Install PHP 5.6.31
6: Install PHP 7.0.21
7: Install PHP 7.1.7
Enter your choice (1, 2, 3, 4, 5, 6 or 7): 
No input,You will install PHP 5.5.38
===========================
You have 3 options for your Memory Allocator install.
1: Don't install Memory Allocator. (Default)
2: Install Jemalloc
3: Install TCMalloc
Enter your choice (1, 2 or 3): 
No input,You will not install Memory Allocator.

Press any key to install...or Press Ctrl+c to cancel

You will install lnmp stack.
nginx-1.12.1
mysql-5.5.56
php-5.5.38
Enable InnoDB: y
Print lnmp.conf infomation...
Download Mirror: https://soft.vpser.net
Nginx Additional Modules: 
PHP Additional Modules: 
Database Directory: /usr/local/mysql/var
Default Website Directory: /home/wwwroot/default
CentOS 6.9
CentOS release 6.9 (Final)
Kernel \r on an \m
.
.
.
.
.
.

============================Install PHPMyAdmin=================================
============================phpMyAdmin install completed=======================
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]
Add Startup and Starting LNMP...
Add nginx service at system startup...
Starting nginx...  done
Add mysql service at system startup...
Starting MySQL.. SUCCESS! 
Add php-fpm service at system startup...
Starting php-fpm  done
============================== Check install ==============================
Checking ...
Nginx: OK
MySQL: OK
PHP: OK
PHP-FPM: OK
Clean src directory...
+------------------------------------------------------------------------+
|          LNMP V1.4 for CentOS Linux Server, Written by Licess          |
+------------------------------------------------------------------------+
|           For more information please visit https://lnmp.org           |
+------------------------------------------------------------------------+
|    lnmp status manage: lnmp {start|stop|reload|restart|kill|status}    |
+------------------------------------------------------------------------+
|  phpMyAdmin: http://IP/phpmyadmin/                                     |
|  phpinfo: http://IP/phpinfo.php                                        |
|  Prober:  http://IP/p.php                                              |
+------------------------------------------------------------------------+
|  Add VirtualHost: lnmp vhost add                                       |
+------------------------------------------------------------------------+
|  Default directory: /home/wwwroot/default                              |
+------------------------------------------------------------------------+
|  MySQL/MariaDB root password: 123qwe                          |
+------------------------------------------------------------------------+
+-------------------------------------------+
|    Manager for LNMP, Written by Licess    |
+-------------------------------------------+
|              https://lnmp.org             |
+-------------------------------------------+
nginx (pid 11289 11287) is running...
php-fpm is runing!
 SUCCESS! MySQL running (11794)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State      
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      
tcp        0      0 :::22                       :::*                        LISTEN      
tcp        0      0 :::2333                     :::*                        LISTEN      
Install lnmp takes 19 minutes.
Install lnmp V1.4 completed! enjoy it.
^C[root@vultr lnmp1.4]# 
  • 正确标示
这时候你在浏览器输入http://IP 例如 http://45.32.195.77便可以访问了。看到的内容如下:
访问页面
  • 搭载WordPress站点
[root@vultr lnmp1.4]# cd /home/wwwroot/
[root@vultr wwwroot]# mv default old
[root@vultr wwwroot]# wget https://cn.wordpress.org/wordpress-4.9-zh_CN.tar.gz
--2017-11-23 15:54:52--  https://cn.wordpress.org/wordpress-4.9-zh_CN.tar.gz
正在解析主机 cn.wordpress.org... 66.155.40.249, 66.155.40.250
正在连接 cn.wordpress.org|66.155.40.249|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:10130811 (9.7M) [application/octet-stream]
正在保存至: “wordpress-4.9-zh_CN.tar.gz”

100%[====================>] 10,130,811  22.5M/s   in 0.4s    

2017-11-23 15:54:53 (22.5 MB/s) - 已保存 “wordpress-4.9-zh_CN.tar.gz” [10130811/10130811])

[root@vultr wwwroot]# tar -zxvf wordpress-4.9-zh_CN.tar.gz
wordpress/
wordpress/wp-mail.php
wordpress/wp-load.php
wordpress/wp-content/
wordpress/wp-content/themes/
wordpress/wp-content/themes/index.php
.
.
.
wordpress/wp-admin/press-this.php
wordpress/readme.html
[root@vultr wwwroot]# ls
old  wordpress  wordpress-4.9-zh_CN.tar.gz
[root@vultr wwwroot]# mv wordpress default
[root@vultr wwwroot]# ls
default  old  wordpress-4.9-zh_CN.tar.gz
[root@vultr wwwroot]# chown -R 755 /home/wwwroot
chown: 正在更改"/home/wwwroot/old/.user.ini" 的所有者: 不允许的操作
[root@vultr wwwroot]# chown -R www:www /home/wwwroot
chown: 正在更改"/home/wwwroot/old/.user.ini" 的所有者: 不允许的操作
[root@vultr wwwroot]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.56-log Source distribution

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

Oracle is a registered trademark of Oracle Corporation and/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 database wordpress;
Query OK, 1 row affected (0.00 sec)

mysql> show database;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| wordpress          |
+--------------------+
4 rows in set (0.00 sec)

mysql> exit
Bye
[root@vultr wwwroot]# 
  • 正确标示
这时候在此通过浏览器访问 http://IP 例如 http://45.32.195.77,浏览器将自动跳转到http://45.32.195.77/wp-admin/setup-config.php,这就是wordpress的配置页面了,看到的内容如下:
访问页面
  • 数据库配置


    数据库配置
输入信息:
数据库名:wordpress
用户名:root
密码:root
数据库主机:localhost
表前缀:wp_
  • 配置WordPress

你可能感兴趣的:(自己搭建网站笔记)