主机分配 2、源码安装nginx 4.1、修改php-fpm.conf配置 4.2、修改nginx配置文件 验证 访问192.168.20.30进行安装
基于LNMP的discuz论坛的实现
LNMP介绍: LNMP的组成 LNMP是指一组通常一起使用来运行动态网站或者服务器的自由软件名称首字母缩写。L指Linux,N指Nginx,M一般指MySQL,也可以指MariaDB,P一般指PHP,也可以指Perl或Python。 [ LNMP简介] - LNMP代表的就是:Linux系统下Nginx+MySQL+PHP这种网站服务器架构。 - Linux是一类Unix计算机操作系统的统称,是目前最流行的免费操作系统。代表版本有:debian、centos、ubuntu、fedora、gentoo等。 - Nginx是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP代理服务器。 - Mysql是一个小型关系型数据库管理系统。 - PHP是一种在服务器端执行的嵌入HTML文档的脚本语言。 这四种软件均为免费开源软件,组合到一起,成为一个免费、高效、扩展性强的网站服务系统。 [特点 ] - Nginx是一个小巧而高效的Linux下的Web服务器软件,是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler 站点开发的,已经在一些俄罗斯的大型网站上运行多年,相当的稳定。 - Nginx性能稳定、功能丰富、运维简单、处理静态文件速度快且消耗系统资源极少。 [ 优点] - 作为 Web 服务器:相比 Apache,Nginx 使用更少的资源,支持更多的并发连接,体现更高的效率。 - 作为负载均衡服务器:Nginx 既可以在内部直接支持Rails和PHP,也可以支持作为 HTTP代理服务器对外进行服务。Nginx 用C编写,不论是系统资源开销还是CPU使用效率都比Perlbal要好的多。 - 作为邮件代理服务器:Nginx同时也是一个非常优秀的邮件代理服务器(最早开发这个产品的目的之一也是作为邮件代理服务器),Last/fm 描述了成功并且美妙的使用经验。 - Nginx 安装非常的简单,配置文件非常简洁(还能够支持perl语法)。Nginx支持平滑加载新的配置,还能够在不间断服务的情况下进行软件版本的升级。
服务
IP
LNMP
192.168.20.30
MySQL的具体介绍:MySQL的源码安装 1 rz 2 yum -y install bison cmake ncurses-devel openssl-devel perl-Data-Dumper 3 tar -zxf mysql-5.6.46.tar.gz 4 cd mysql-5.6.46/ 5 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/etc -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all 6 make -j8 && make install
--DCMAKE_INSTALL_PREFIX 安装路径 -DSYSCONFDIR 指定mysql配置文件目录 -DDEFAULT_CHARSET 设置mysql默认字符集 -DDEFAULT_COLLATION 默认编码格式 -DWITH_EXTRA_CHARSETS 指定mysql可用的其他字符集
7 ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib 8 ln -s /usr/local/mysql/bin/* /usr/local/bin/ 9 useradd -M -s /sbin/nologin mysql 10 chown -R mysql:mysql /usr/local/mysql/ 11 cd support-files/ 12 cp my-default.cnf /etc/my.cnf 13 cp mysql.server /etc/init.d/mysqld 14 vim /etc/init.d/mysqld 46 basedir=/usr/local/mysql ##MySQL安装路径 47 datadir=/usr/local/mysql/data ## 数据存放目录 15 chmod +x /etc/init.d/mysqld
16、/usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql Installing MySQL system tables...2020-05-31 16:20:24 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2020-05-31 16:20:24 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 2020-05-31 16:20:24 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.46) starting as process 21647 ... 2020-05-31 16:20:24 21647 [Note] InnoDB: Using atomics to ref count buffer pool pages 2020-05-31 16:20:24 21647 [Note] InnoDB: The InnoDB memory heap is disabled 2020-05-31 16:20:24 21647 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2020-05-31 16:20:24 21647 [Note] InnoDB: Memory barrier is not used 2020-05-31 16:20:24 21647 [Note] InnoDB: Compressed tables use zlib 1.2.11 2020-05-31 16:20:24 21647 [Note] InnoDB: Using CPU crc32 instructions 2020-05-31 16:20:24 21647 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2020-05-31 16:20:24 21647 [Note] InnoDB: Completed initialization of buffer pool 2020-05-31 16:20:24 21647 [Note] InnoDB: Highest supported file format is Barracuda. 2020-05-31 16:20:24 21647 [Note] InnoDB: 128 rollback segment(s) are active. 2020-05-31 16:20:24 21647 [Note] InnoDB: Waiting for purge to start 2020-05-31 16:20:24 21647 [Note] InnoDB: 5.6.46 started; log sequence number 1626027 2020-05-31 16:20:24 21647 [Note] RSA private key file not found: /usr/local/mysql/data//private_key.pem. Some authentication plugins will not work. 2020-05-31 16:20:24 21647 [Note] RSA public key file not found: /usr/local/mysql/data//public_key.pem. Some authentication plugins will not work. 2020-05-31 16:20:24 21647 [Note] Binlog end 2020-05-31 16:20:24 21647 [Note] InnoDB: FTS optimize thread exiting. 2020-05-31 16:20:24 21647 [Note] InnoDB: Starting shutdown... 2020-05-31 16:20:25 21647 [Note] InnoDB: Shutdown completed; log sequence number 1626037 OK Filling help tables...2020-05-31 16:20:25 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2020-05-31 16:20:25 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 2020-05-31 16:20:25 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.6.46) starting as process 21670 ... 2020-05-31 16:20:25 21670 [Note] InnoDB: Using atomics to ref count buffer pool pages 2020-05-31 16:20:25 21670 [Note] InnoDB: The InnoDB memory heap is disabled 2020-05-31 16:20:25 21670 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2020-05-31 16:20:25 21670 [Note] InnoDB: Memory barrier is not used 2020-05-31 16:20:25 21670 [Note] InnoDB: Compressed tables use zlib 1.2.11 2020-05-31 16:20:25 21670 [Note] InnoDB: Using CPU crc32 instructions 2020-05-31 16:20:25 21670 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2020-05-31 16:20:25 21670 [Note] InnoDB: Completed initialization of buffer pool 2020-05-31 16:20:25 21670 [Note] InnoDB: Highest supported file format is Barracuda. 2020-05-31 16:20:25 21670 [Note] InnoDB: 128 rollback segment(s) are active. 2020-05-31 16:20:25 21670 [Note] InnoDB: Waiting for purge to start 2020-05-31 16:20:25 21670 [Note] InnoDB: 5.6.46 started; log sequence number 1626037 2020-05-31 16:20:25 21670 [Note] RSA private key file not found: /usr/local/mysql/data//private_key.pem. Some authentication plugins will not work. 2020-05-31 16:20:25 21670 [Note] RSA public key file not found: /usr/local/mysql/data//public_key.pem. Some authentication plugins will not work. 2020-05-31 16:20:25 21670 [Note] Binlog end 2020-05-31 16:20:25 21670 [Note] InnoDB: FTS optimize thread exiting. 2020-05-31 16:20:25 21670 [Note] InnoDB: Starting shutdown... 2020-05-31 16:20:27 21670 [Note] InnoDB: Shutdown completed; log sequence number 1626047 OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/local/mysql/bin/mysqladmin -u root password 'new-password' /usr/local/mysql/bin/mysqladmin -u root -h lpj3 password 'new-password' Alternatively you can run: /usr/local/mysql/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd . ; /usr/local/mysql/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd mysql-test ; perl mysql-test-run.pl Please report any problems at https://bugs.mysql.com/ The latest information about MySQL is available on the web at https://www.mysql.com Support MySQL by buying support/licenses at https://shop.mysql.com WARNING: Found existing config file /usr/local/mysql/my.cnf on the system. Because this file might be in use, it was not replaced, but was used in bootstrap (unless you used --defaults-file) and when you later start the server. The new default config file was created as /usr/local/mysql/my-new.cnf, please compare it with your file and take the changes you need. WARNING: Default config file /etc/my.cnf exists on the system This file will be read by default by the MySQL server If you do not want to use this, either remove it, or use the --defaults-file argument to mysqld_safe when starting the server
[root@lpj3 support-files]# /etc/init.d/mysqld start Starting MySQL.Logging to '/usr/local/mysql/data/lpj3.err'. SUCCESS! [root@lpj3 support-files]# netstat -anput | grep LISTEN | grep 3306 tcp6 0 0 :::3306 :::* LISTEN 21832/mysqld [root@lpj3 support-files]# mysqladmin -uroot password 123456 Warning: Using a password on the command line interface can be insecure. [root@lpj3 support-files]# mysql -uroot -p123456 Warning: Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 2 Server version: 5.6.46 Source distribution Copyright (c) 2000, 2019, 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> 查看是否启动 [root@lpj3 ~]# netstat -anput | grep LISTEN |grep 3306 tcp6 0 0 :::3306 :::* LISTEN 21832/mysqld
[root@lpj3 ~]# yum -y install gcc gcc-c++ openssl-devel zlib-devel pcre-devel [root@lpj3 ~]# tar -zxf nginx-1.11.5.tar.gz [root@lpj3 ~]# cd nginx-1.11.5/ [root@lpj3 nginx-1.11.5]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module [root@lpj3 nginx-1.11.5]# ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/ [root@lpj3 nginx-1.11.5]# nginx -v nginx version: nginx/1.11.5
./configure --prefix=/usr/local/php --with-gd --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-config-file-path=/usr/local/php --enable-mbstring --enable-fpm --with-jpeg-dir=/usr/lib [root@lpj3 php-7.2.0]# tar -zxf php-7.2.0.tar.gz [root@lpj3 php-7.2.0]# cd php-7.2.0/ [root@lpj3 php-7.2.0]# ./configure --prefix=/usr/local/php --with-gd --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-config-file-path=/usr/local/php --enable-mbstring --enable-fpm --with-jpeg-dir=/usr/lib [root@lpj3 php-7.2.0]# make -j8 && make install Build complete. Don't forget to run 'make test'. Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/ Installing PHP CLI binary: /usr/local/php/bin/ Installing PHP CLI man page: /usr/local/php/php/man/man1/ Installing PHP FPM binary: /usr/local/php/sbin/ Installing PHP FPM defconfig: /usr/local/php/etc/ Installing PHP FPM man page: /usr/local/php/php/man/man8/ Installing PHP FPM status page: /usr/local/php/php/php/fpm/ Installing phpdbg binary: /usr/local/php/bin/ Installing phpdbg man page: /usr/local/php/php/man/man1/ Installing PHP CGI binary: /usr/local/php/bin/ Installing PHP CGI man page: /usr/local/php/php/man/man1/ Installing build environment: /usr/local/php/lib/php/build/ Installing header files: /usr/local/php/include/php/ Installing helper programs: /usr/local/php/bin/ program: phpize program: php-config Installing man pages: /usr/local/php/php/man/man1/ page: phpize.1 page: php-config.1 Installing PEAR environment: /usr/local/php/lib/php/ [PEAR] Archive_Tar - installed: 1.4.3 [PEAR] Console_Getopt - installed: 1.4.1 [PEAR] Structures_Graph- installed: 1.1.1 [PEAR] XML_Util - installed: 1.4.2 [PEAR] PEAR - installed: 1.10.5 Wrote PEAR system config file at: /usr/local/php/etc/pear.conf You may want to add: /usr/local/php/lib/php to your php.ini include_path /root/nginx-1.11.5/php-7.2.0/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin ln -s -f phar.phar /usr/local/php/bin/phar Installing PDO headers: /usr/local/php/include/php/ext/pdo/ [root@lpj3 php-7.2.0]# cp php.ini-development /usr/local/php/php.ini [root@lpj3 php-7.2.0]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm [root@lpj3 php-7.2.0]#chmod +x /etc/init.d/php-fpm [root@lpj3 php-7.2.0]#cd /usr/local/php/etc [root@lpj3 php-7.2.0]#cp php-fpm.conf.default php-fpm.conf [root@lpj3 php-7.2.0]#cp php-fpm.d/www.conf.default php-fpm.d/www.conf [root@lpj3 php-7.2.0]#ln -s /usr/local/php/bin/* /usr/local/bin/ [root@lpj3 php-7.2.0]#ln -s /usr/local/php/sbin/* /usr/local/sbin/
vim php-fpm.conf 17 pid = run/php-fpm.pid #取消pid注释 69 process.max = 128 #取消注释 fork出的子进程的最多数量 100 events.mechanism = epoll #使用epoll模型 取消注释 编辑PHP测试页面 [root@lpj3 ~]# vim /usr/local/nginx/html/test1.php <?php phpinfo(); ?> [root@lpj3 ~]# vim /usr/local/nginx/html/test2.php <?php $con = new mysqli('192.168.20.128','root','123456'); if(!$con) die("connect error:".mysqli_connect_error()); else echo "connet mysql server ok!n"; ?> 启动服务 [root@lpj3 ~]# /etc/init.d/php-fpm start Starting php-fpm done 查看是否启动 [root@lpj3 ~]# netstat -anput | grep LISTEN |grep 9000 tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 60351/php-fpm: mast
在原有localtion下面加如下内容 #index.php 43 location / { 44 root html; 45 index index.php index.html index.htm; 46 } 65-71行取消注释 65 location ~ .php$ { 66 root html; 67 fastcgi_pass 127.0.0.1:9000; 68 fastcgi_index index.php; 69 fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 70 include fastcgi_params; 71 } 71行更改 fastcgi_params;为 fastcgi.conf 65 location ~ .php$ { 66 root html; 67 fastcgi_pass 127.0.0.1:9000; 68 fastcgi_index index.php; 69 fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 70 include fastcgi.conf; 71 } 检测nginx配置文件 [root@lpj3 etc]# nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: [emerg] getpwnam("nginx") failed #原因是没有创建nginx程序用户导致 进行创建nginx程序用户即可 [root@lpj3 etc]# useradd -s /sbin/nologin -M nginx [root@lpj3 etc]# nginx -t 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 启动服务 [root@lpj3 etc]# nginx 查看是否启动 [root@lpj3 ~]# netstat -anput | grep LISTEN |grep 80 tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 60151/nginx: master
验证https://192.168.20.30/test2.php
https://192.168.20.30/test1.php
即可
5、隐藏之前的测试页面把之前做的测试页面进行隐藏 [root@lpj3 ~]# cd /usr/local/nginx/html/ [root@lpj3 html]# ls 50x.html index.html test1.php test2.php [root@lpj3 html]# mkdir backup [root@lpj3 html]# mv *.* backup/ [root@lpj3 html]# ls backup
6、部署DISCUZ [root@lpj3 ~]# unzip ComsenzDiscuz-DiscuzX-master.zip [root@lpj3 ~]# cp -r DiscuzX/upload/* /usr/local/nginx/html/ [root@lpj3 ~]# chmod -R 777 /usr/local/nginx/html/
![在这里插入图片描述](https://img-blog.csdnimg.cn/20200531181836387.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NTA3NDUzMg==,size_16,color_FFFFFF,t_70
如上图 如果提醒已安装 可以删除安装锁 重新安装 [root@localhost ~]# rm -rf /usr/local/httpd/htdocs/data/install.lock
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox网页视频下载器 下载地址: ImovieBox网页视频下载器-最新版本下载
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
阅读和此文章类似的: 全球云计算