在:
之后,去继续参考:
LNMP添加、删除虚拟主机及伪静态使用教程 – LNMP一键安装包
去添加虚拟主机
先看看有哪些命令:
[root@crifan lnmp1.4]# pwd /root/lnmp1.4 [root@crifan lnmp1.4]# ll total 92 -rwxr-xr-x 1 root root 8647 Jun 1 14:06 addons.sh -rw-r–r– 1 root root 11290 Jun 1 14:06 ChangeLog drwxr-xr-x 3 root root 4096 Aug 23 21:47 conf drwxr-xr-x 2 root root 4096 Aug 19 11:28 include drwxr-xr-x 2 root root 4096 May 29 08:43 init.d -rwxr-xr-x 1 root root 5777 Aug 1 22:12 install.sh -rw-r–r– 1 root root 209 Jul 3 2016 License -rwxr-xr-x 1 root root 313 Sep 4 21:23 lnmp.conf -rwxr-xr-x 1 root root 4806 Jun 1 14:06 pureftpd.sh -rw-r–r– 1 root root 6137 Jun 1 14:08 README drwxr-xr-x 6 root root 4096 Sep 5 09:58 src drwxr-xr-x 2 root root 4096 Apr 1 09:49 tools -rwxr-xr-x 1 root root 6460 Jun 1 14:06 uninstall.sh -rwxr-xr-x 1 root root 2567 Jun 12 21:27 upgrade1.x-1.4.sh -rwxr-xr-x 1 root root 2777 Jun 1 14:06 upgrade.sh [root@crifan lnmp1.4]# which lnmp /usr/bin/lnmp [root@crifan lnmp1.4]# lnmp help +——————————————-+ | Manager for LNMP, Written by Licess | +——————————————-+ | https://lnmp.org | +——————————————-+ Usage: lnmp {start|stop|reload|restart|kill|status} Usage: lnmp {nginx|mysql|mariadb|php-fpm|pureftpd} {start|stop|reload|restart|kill|status} Usage: lnmp vhost {add|list|del} Usage: lnmp database {add|list|edit|del} Usage: lnmp ftp {add|list|edit|del|show} Usage: lnmp ssl add [root@crifan lnmp1.4]# lnmp vhost add +——————————————-+ | Manager for LNMP, Written by Licess | +——————————————-+ | https://lnmp.org | +——————————————-+ Please enter domain(example: www.lnmp.org):www.crifan.com Your domain: www.crifan.com domain list: crifan.com Please enter the directory for the domain: www.crifan.com Default directory: /home/wwwroot/www.crifan.com: /home/wwwroot/www.crifan.com Virtual Host Directory: /home/wwwroot/www.crifan.com Allow Rewrite rule? (y/n) y Please enter the rewrite of programme, wordpress,discuz,typecho,sablog,typecho rewrite was exist. (Default rewrite: other): wordpress You choose rewrite: wordpress Allow access log? (y/n) n Disable access log. Create database and MySQL user with same name (y/n) y Enter current root password of Database (Password will not shown): OK, MySQL root password correct. Enter database name: crifan_wp_db Your will create a database and MySQL user with same name: crifan_wp_db Please enter password for mysql user crifan_wp_db: xxx Your password: xxx Add SSL Certificate (y/n) y 1: Use your own SSL Certificate and Key 2: Use Let’s Encrypt to create SSL Certificate and Key Enter 1 or 2: 2 Please enter your email address: [email protected] It will be processed automatically. Press any key to start create virtul host… |
然后就是去创建了:
Create Virtul Host directory…… set permissions of Virtual Host directory…… You select the exist rewrite rule:/usr/local/nginx/conf/wordpress.conf Test Nginx configure file…… nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful Reload Nginx…… Gracefully shutting down php-fpm . done Starting php-fpm done Add database Sucessfully. You select the exist rewrite rule:/usr/local/nginx/conf/wordpress.conf Test Nginx configure file…… nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful Reload Nginx…… <div–<2017-09-05 10:09:34– https://dl.eff.org/certbot-auto Resolving dl.eff.org (dl.eff.org)… 2a04:4e42:e::201, 151.101.56.201 Connecting to dl.eff.org (dl.eff.org)|2a04:4e42:e::201|:443… connected. HTTP request sent, awaiting response… 200 OK Length: 50930 (50K) [application/octet-stream] Saving to: bin/certbot 0% [ ] 0 100%[==================================================================================================>] 50,930 –.-K/s in 0.001s 2017-09-05 10:09:35 (61.2 MB/s) – bin/certbotsaved [50930/50930] Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.fileplanet.com * extras: mirror.fileplanet.com * updates: mirror.fileplanet.com Resolving Dependencies <div–<> Running transaction check <div–<-> Package epel-release.noarch 0:7-9 will be installed <div–<> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================ Package Arch Version Repository Size ============================================================================================================================================ Installing: epel-release noarch 7-9 extras 14 k Transaction Summary ============================================================================================================================================ Install 1 Package Total download size: 14 k Installed size: 24 k Downloading packages: epel-release-7-9.noarch.rpm | 14 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : epel-release-7-9.noarch 1/1 Verifying : epel-release-7-9.noarch 1/1 Installed: epel-release.noarch 0:7-9 Complete! Starting create SSL Certificate use Let’s Encrypt… Bootstrapping dependencies for RedHat-based OSes… (you can skip this with –no-bootstrap) yum is /bin/yum Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.fileplanet.com * epel: reflector.westga.edu * extras: mirror.fileplanet.com * updates: mirror.fileplanet.com Package gcc-4.8.5-11.el7.x86_64 already installed and latest version Package 1:openssl-1.0.1e-60.el7_3.1.x86_64 already installed and latest version Package 1:openssl-devel-1.0.1e-60.el7_3.1.x86_64 already installed and latest version Package ca-certificates-2017.2.14-70.1.el7_3.noarch already installed and latest version Package python-2.7.5-48.el7.x86_64 already installed and latest version Resolving Dependencies <div–<> Running transaction check <div–<-> Package augeas-libs.x86_64 0:1.4.0-2.el7 will be installed <div–<-> Package libffi-devel.x86_64 0:3.0.13-18.el7 will be installed <div–<-> Package python-devel.x86_64 0:2.7.5-48.el7 will be installed <div–<-> Package python-tools.x86_64 0:2.7.5-48.el7 will be installed <div–<> Processing Dependency: tkinter = 2.7.5-48.el7 for package: python-tools-2.7.5-48.el7.x86_64 <div–<-> Package python-virtualenv.noarch 0:1.10.1-3.el7 will be installed <div–<> Processing Dependency: python-setuptools for package: python-virtualenv-1.10.1-3.el7.noarch <div–<-> Package python2-pip.noarch 0:8.1.2-5.el7 will be installed <div–<-> Package redhat-rpm-config.noarch 0:9.1.0-72.el7.centos will be installed <div–<> Processing Dependency: dwz >= 0.4 for package: redhat-rpm-config-9.1.0-72.el7.centos.noarch <div–<> Processing Dependency: zip for package: redhat-rpm-config-9.1.0-72.el7.centos.noarch <div–<> Processing Dependency: perl-srpm-macros for package: redhat-rpm-config-9.1.0-72.el7.centos.noarch <div–<> Running transaction check <div–<-> Package dwz.x86_64 0:0.11-3.el7 will be installed <div–<-> Package perl-srpm-macros.noarch 0:1-8.el7 will be installed <div–<-> Package python-setuptools.noarch 0:0.9.8-4.el7 will be installed <div–<> Processing Dependency: python-backports-ssl_match_hostname for package: python-setuptools-0.9.8-4.el7.noarch <div–<-> Package tkinter.x86_64 0:2.7.5-48.el7 will be installed <div–<> Processing Dependency: libtk8.5.so()(64bit) for package: tkinter-2.7.5-48.el7.x86_64 <div–<> Processing Dependency: libtcl8.5.so()(64bit) for package: tkinter-2.7.5-48.el7.x86_64 <div–<> Processing Dependency: libTix.so()(64bit) for package: tkinter-2.7.5-48.el7.x86_64 <div–<-> Package zip.x86_64 0:3.0-11.el7 will be installed <div–<> Running transaction check <div–<-> Package python-backports-ssl_match_hostname.noarch 0:3.4.0.2-4.el7 will be installed <div–<> Processing Dependency: python-backports for package: python-backports-ssl_match_hostname-3.4.0.2-4.el7.noarch <div–<-> Package tcl.x86_64 1:8.5.13-8.el7 will be installed <div–<-> Package tix.x86_64 1:8.4.3-12.el7 will be installed <div–<-> Package tk.x86_64 1:8.5.13-6.el7 will be installed <div–<> Processing Dependency: libXft.so.2()(64bit) for package: 1:tk-8.5.13-6.el7.x86_64 <div–<> Running transaction check <div–<-> Package libXft.x86_64 0:2.3.2-2.el7 will be installed <div–<> Processing Dependency: libXrender.so.1()(64bit) for package: libXft-2.3.2-2.el7.x86_64 <div–<-> Package python-backports.x86_64 0:1.0-8.el7 will be installed <div–<> Running transaction check <div–<-> Package libXrender.x86_64 0:0.9.8-2.1.el7 will be installed <div–<> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================ Package Arch Version Repository Size ============================================================================================================================================ Installing: augeas-libs x86_64 1.4.0-2.el7 base 355 k libffi-devel x86_64 3.0.13-18.el7 base 23 k python-devel x86_64 2.7.5-48.el7 base 393 k python-tools x86_64 2.7.5-48.el7 base 852 k python-virtualenv noarch 1.10.1-3.el7 base 1.2 M python2-pip noarch 8.1.2-5.el7 epel 1.7 M redhat-rpm-config noarch 9.1.0-72.el7.centos base 78 k Installing for dependencies: dwz x86_64 0.11-3.el7 base 99 k libXft x86_64 2.3.2-2.el7 base 58 k libXrender x86_64 0.9.8-2.1.el7 base 25 k perl-srpm-macros noarch 1-8.el7 base 4.6 k python-backports x86_64 1.0-8.el7 base 5.8 k python-backports-ssl_match_hostname noarch 3.4.0.2-4.el7 base 12 k python-setuptools noarch 0.9.8-4.el7 base 396 k tcl x86_64 1:8.5.13-8.el7 base 1.9 M tix x86_64 1:8.4.3-12.el7 base 254 k tk x86_64 1:8.5.13-6.el7 base 1.4 M tkinter x86_64 2.7.5-48.el7 base 322 k zip x86_64 3.0-11.el7 base 260 k Transaction Summary ============================================================================================================================================ Install 7 Packages (+12 Dependent packages) Total download size: 9.3 M Installed size: 27 M Downloading packages: (1/19): augeas-libs-1.4.0-2.el7.x86_64.rpm | 355 kB 00:00:00 (2/19): dwz-0.11-3.el7.x86_64.rpm | 99 kB 00:00:00 (3/19): libXrender-0.9.8-2.1.el7.x86_64.rpm | 25 kB 00:00:00 (4/19): libXft-2.3.2-2.el7.x86_64.rpm | 58 kB 00:00:00 (5/19): perl-srpm-macros-1-8.el7.noarch.rpm | 4.6 kB 00:00:00 (6/19): python-backports-1.0-8.el7.x86_64.rpm | 5.8 kB 00:00:00 (7/19): python-backports-ssl_match_hostname-3.4.0.2-4.el7.noarch.rpm | 12 kB 00:00:00 (8/19): python-devel-2.7.5-48.el7.x86_64.rpm | 393 kB 00:00:00 (9/19): libffi-devel-3.0.13-18.el7.x86_64.rpm | 23 kB 00:00:00 (10/19): python-tools-2.7.5-48.el7.x86_64.rpm | 852 kB 00:00:00 (11/19): python-virtualenv-1.10.1-3.el7.noarch.rpm | 1.2 MB 00:00:00 (12/19): redhat-rpm-config-9.1.0-72.el7.centos.noarch.rpm | 78 kB 00:00:00 (13/19): tcl-8.5.13-8.el7.x86_64.rpm | 1.9 MB 00:00:00 (14/19): python-setuptools-0.9.8-4.el7.noarch.rpm | 396 kB 00:00:00 (15/19): tix-8.4.3-12.el7.x86_64.rpm | 254 kB 00:00:00 (16/19): tk-8.5.13-6.el7.x86_64.rpm | 1.4 MB 00:00:00 (17/19): tkinter-2.7.5-48.el7.x86_64.rpm | 322 kB 00:00:00 (18/19): zip-3.0-11.el7.x86_64.rpm | 260 kB 00:00:00 warning: /var/cache/yum/x86_64/7/epel/packages/python2-pip-8.1.2-5.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEYTA Public key for python2-pip-8.1.2-5.el7.noarch.rpm is not installed (19/19): python2-pip-8.1.2-5.el7.noarch.rpm | 1.7 MB 00:00:00 <div–<—————————————————————————————————————————————— Total 9.0 MB/s | 9.3 MB 00:00:01 Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 Importing GPG key 0x352C64E5: Userid : "Fedora EPEL (7) <[email protected]>" Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5 Package : epel-release-7-9.noarch (@extras) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 1:tcl-8.5.13-8.el7.x86_64 1/19 Installing : python-devel-2.7.5-48.el7.x86_64 2/19 Installing : dwz-0.11-3.el7.x86_64 3/19 Installing : libXrender-0.9.8-2.1.el7.x86_64 4/19 Installing : libXft-2.3.2-2.el7.x86_64 5/19 Installing : 1:tk-8.5.13-6.el7.x86_64 6/19 Installing : 1:tix-8.4.3-12.el7.x86_64 7/19 Installing : tkinter-2.7.5-48.el7.x86_64 8/19 Installing : perl-srpm-macros-1-8.el7.noarch 9/19 Installing : zip-3.0-11.el7.x86_64 10/19 Installing : python-backports-1.0-8.el7.x86_64 11/19 Installing : python-backports-ssl_match_hostname-3.4.0.2-4.el7.noarch 12/19 Installing : python-setuptools-0.9.8-4.el7.noarch 13/19 Installing : python-virtualenv-1.10.1-3.el7.noarch 14/19 Installing : python2-pip-8.1.2-5.el7.noarch 15/19 Installing : redhat-rpm-config-9.1.0-72.el7.centos.noarch 16/19 Installing : python-tools-2.7.5-48.el7.x86_64 17/19 Installing : augeas-libs-1.4.0-2.el7.x86_64 18/19 Installing : libffi-devel-3.0.13-18.el7.x86_64 19/19 Verifying : python-virtualenv-1.10.1-3.el7.noarch 1/19 Verifying : libffi-devel-3.0.13-18.el7.x86_64 2/19 Verifying : 1:tcl-8.5.13-8.el7.x86_64 3/19 Verifying : python-backports-ssl_match_hostname-3.4.0.2-4.el7.noarch 4/19 Verifying : python2-pip-8.1.2-5.el7.noarch 5/19 Verifying : libXft-2.3.2-2.el7.x86_64 6/19 Verifying : python-tools-2.7.5-48.el7.x86_64 7/19 Verifying : python-backports-1.0-8.el7.x86_64 8/19 Verifying : zip-3.0-11.el7.x86_64 9/19 Verifying : redhat-rpm-config-9.1.0-72.el7.centos.noarch 10/19 Verifying : tkinter-2.7.5-48.el7.x86_64 11/19 Verifying : perl-srpm-macros-1-8.el7.noarch 12/19 Verifying : 1:tk-8.5.13-6.el7.x86_64 13/19 Verifying : python-setuptools-0.9.8-4.el7.noarch 14/19 Verifying : libXrender-0.9.8-2.1.el7.x86_64 15/19 Verifying : dwz-0.11-3.el7.x86_64 16/19 Verifying : python-devel-2.7.5-48.el7.x86_64 17/19 Verifying : augeas-libs-1.4.0-2.el7.x86_64 18/19 Verifying : 1:tix-8.4.3-12.el7.x86_64 19/19 Installed: augeas-libs.x86_64 0:1.4.0-2.el7 libffi-devel.x86_64 0:3.0.13-18.el7 python-devel.x86_64 0:2.7.5-48.el7 python-tools.x86_64 0:2.7.5-48.el7 python-virtualenv.noarch 0:1.10.1-3.el7 python2-pip.noarch 0:8.1.2-5.el7 redhat-rpm-config.noarch 0:9.1.0-72.el7.centos Dependency Installed: dwz.x86_64 0:0.11-3.el7 libXft.x86_64 0:2.3.2-2.el7 libXrender.x86_64 0:0.9.8-2.1.el7 perl-srpm-macros.noarch 0:1-8.el7 python-backports.x86_64 0:1.0-8.el7 python-backports-ssl_match_hostname.noarch 0:3.4.0.2-4.el7 python-setuptools.noarch 0:0.9.8-4.el7 tcl.x86_64 1:8.5.13-8.el7 tix.x86_64 1:8.4.3-12.el7 tk.x86_64 1:8.5.13-6.el7 tkinter.x86_64 0:2.7.5-48.el7 zip.x86_64 0:3.0-11.el7 Complete! Creating virtual environment… Installing Python packages… Installation succeeded. Saving debug log to /var/log/letsencrypt/letsencrypt.log Obtaining a new certificate Performing the following challenges: http-01 challenge for www.crifan.com http-01 challenge for crifan.com Using the webroot path /home/wwwroot/www.crifan.com for all unmatched domains. Waiting for verification… Cleaning up challenges Failed authorization procedure. www.crifan.com (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from https://www.crifan.com/.well-known/acme-challenge/4IXUqR6devmWQPYOovfuizaNddZ72FgmLQIFmtDyeKU: "<html> <head><title>404 Not Found</title></head> <body bgcolor="white"> <center><h1>404 Not Found</h1></center> <hr><center>", crifan.com (http-01): urn:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from https://crifan.com/.well-known/acme-challenge/S0KJCVsOxImUbRHVMR6q3xnPrDmF2-icl1Tu_D2BvGQ: "<html> <head><title>404 Not Found</title></head> <body bgcolor="white"> <center><h1>404 Not Found</h1></center> <hr><center>" IMPORTANT NOTES: – The following errors were reported by the server: Domain: www.crifan.com Type: unauthorized Detail: Invalid response from "<html> <head><title>404 Not Found</title></head> <body bgcolor="white"> <center><h1>404 Not Found</h1></center> <hr><center>" Domain: crifan.com Type: unauthorized Detail: Invalid response from "<html> <head><title>404 Not Found</title></head> <body bgcolor="white"> <center><h1>404 Not Found</h1></center> <hr><center>" To fix these errors, please make sure that your domain name was entered correctly and the DNS A/AAAA record(s) for that domain contain(s) the right IP address. – Your account credentials have been saved in your Certbot configuration directory at /etc/letsencrypt. You should make a secure backup of this folder now. This configuration directory will also contain certificates and private keys obtained by Certbot so making regular backups of this folder is ideal. Let’s Encrypt SSL Certificate create failed! ================================================ Virtualhost infomation: Your domain: www.crifan.com Home Directory: /home/wwwroot/www.crifan.com Rewrite: wordpress Enable log: no Database username: crifan_wp_db Database userpassword: xxx Database Name: crifan_wp_db Create ftp account: no Enable SSL: yes =>Let’s Encrypt ================================================ [root@crifan lnmp1.4]# |
很明显,虚拟主机创建OK了,但是ssl加密失败了。
抽空再去研究ssl加密的事情吧。
(后记:后来单独重新去创建ssl就可以了:【已解决】给Linode的CentOS的crifan.com添加https支持SSL)
[root@crifan lnmp1.4]# lnmp vhost list +——————————————-+ | Manager for LNMP, Written by Licess | +——————————————-+ | https://lnmp.org | +——————————————-+ Nginx Virtualhost list: |
伪静态管理,有空再去弄。(后记:后来好像已经allow rewrite,好像就已经是伪静态了。)
##默认网站(虚拟主机)##
LNMP默认网站配置文件:/usr/local/nginx/conf/nginx.conf
有空再去看看
去看看有哪些数据库:
[root@crifan lnmp1.4]# lnmp vhost list +——————————————-+ | Manager for LNMP, Written by Licess | +——————————————-+ | https://lnmp.org | +——————————————-+ Nginx Virtualhost list: [root@crifan lnmp1.4]# lnmp database list +——————————————-+ | Manager for LNMP, Written by Licess | +——————————————-+ | https://lnmp.org | +——————————————-+ Enter current root password of Database (Password will not shown): OK, MySQL root password correct. +——————–+ | Database | +——————–+ | information_schema | | crifan_wp_db | | mysql | | performance_schema | +——————–+ List all databases Sucessfully. [root@crifan lnmp1.4]# |
其中的crifan_wp_db就是我们前面创建的。
[root@crifan lnmp1.4]# cd /home/wwwroot/ [root@crifan wwwroot]# ll total 8 drwxr-xr-x 3 www www 4096 Sep 5 09:57 crifan drwxr-xr-x 3 www www 4096 Sep 5 10:10 www.crifan.com [root@crifan wwwroot]# cd crifan/ [root@crifan crifan]# ll total 84 -rw-r–r– 1 root root 2781 Sep 5 09:57 index.html -rw-r–r– 1 root root 5683 Sep 5 09:57 lnmp.gif -rw-r–r– 1 root root 20256 Sep 5 09:57 ocp.php -rw-r–r– 1 root root 20 Sep 5 09:57 phpinfo.php drwxr-xr-x 14 www www 4096 Sep 5 09:57 phpmyadmin -rw-r–r– 1 root root 42609 Sep 5 09:57 p.php [root@crifan crifan]# cd ../www.crifan.com/ [root@crifan www.crifan.com]# ll total 0 [root@crifan www.crifan.com]# |
好像不是我希望的目录结构啊
怎么/home/wwwroot/下面
有个crifan -》这个是之前lnmp安装时候的配置的根目录
而此处的
www.crifan.com则是虚拟主机创建的根目录。
去访问看看,当前能否访问到crifan代码的index.html
是可以通过:
访问到lnmp的主页的:
然后对应的地址,都可以用了:
登录后:
然后再去创建ftp用户,并上传文件:
【记录】Linode的CentOS中通过LNMP去创建ftp并上传网站文件
另外:
在折腾:
【已解决】给Linode中的LNMP的crifan.com优化内存占用
期间,想要去搞清楚:
为何之前fzhost中,把禁止scandir的设置去掉
后来搜:
禁止 scandir 作用
参考:
lnmp一键安装wordpress问题拾遗 // viaNull | why not
自己发现了:
如果不把scandir禁止这个限制去掉,wordpress就无法扫描子目录,就找不到了其他的之前已安装的主题了:
所以去 去掉 禁止scandir的 限制:
vi /usr/local/php/etc/php.ini
去掉disable_functions中的scandir
然后重启lnmp restart,之后就可以看到了wordpress中之前已安装的其他的主题了:
转载请注明:在路上 » 【记录】Linode的CentOS中去初始化和配置LNMP