Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Centos6.8 64-bit Discuz runtime environment

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Linux CentOS compilation and installation LNMP environment + discuz + phpmyadmin

Product composition

Full version of Discuz-3.3 UTF8

Nginx-1.6.3

Php-5.5.38

Mysql-5.5.20

Phpmyadmin-4.6.6

Openssl-1.0.0d

Vsftpd

Product characteristics

1. Based on Aliyun pure mirror image, it is convenient, safe, fast and stable.

2. All software should be compiled and installed to minimize the consumption of system resources

3. Discuz is a set of general community forum software system that users can set up with perfect function, strong load capacity and highly customizable forum service through simple setup and installation on the Internet without any programming.

4. Using nginx+php-fpm to better bid farewell to the 502 error caused by configuration

5. Nginx enables https module to support optimized configuration of nginx and nginx data processing capabilities to run stably and quickly.

6. Support pathinfo to enable pdo_mysql and all common components suitable for Discuz operation. 7. Openssl version 1.0.0d

instructions

Website storage directory / data/www

Discuz framework program directory / data/www

Phpmyadmin path / data/www/phpmyadmin

FTP storage path / data/ftp

Default database data storage path / data/mysql

Php storage path / usr/local/php5

Nginx storage path / usr/local/nginx

Mysql storage path / usr/local/mysql

Compiled package storage path / usr/local/src

Discuz framework program access address http://IP/

Mysql account root password 10idccom

Phpmyadmin management address http://IP:81

FTP account admins password 10idccom

Using tutorials

/ etc/init.d/nginx start | stop | restart [start | stop | restart]

/ etc/init.d/php-fpm start | stop | restart [start | stop | restart]

/ etc/init.d/mysql start | stop | restart [start | stop | restart]

Install compilation tools and library files use the CentOS yum command to install yum install-y make apr* autoconf automake curl-devel gcc gcc-c++ zlib-devel openssl openssl-devel pcre-devel kernel keyutils perl kernel-headers compat* mpfr cpp glibc libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel libjpeg-devel libpng-devel zlib-devel libXpm* freetype php-common ncurses* libtool* libxml2 libxml2-devel patch freetype-devel to start the installation of cmakecd / usr/ Local/src # enter the software directory tar zxf cmake-2.8.6.tar.gz # extract the installation package cd cmake-2.8.6 # enter the directory. / configure # installation package configuration make # compile make install # install installation MySQLgroupadd mysql # add mysql group useradd-g mysql mysql-s / sbin/nologin # create user mysql and join The mysql group does not allow mysql users to log in directly to the system mkdir-p / data/mysql # create MySQL database storage directory chown-R mysql:mysql / data/mysql # set MySQL database directory permissions mkdir-p / usr/local/mysql # create MySQL installation directory cd / usr/local/src tar zxf mysql-5.5.20.tar.gz # extract cd mysql-5.5.20 cmake. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_DATADIR=/data/mysql-DSYSCONFDIR=/etc # configure make # compile make install # install cd / usr/local/mysql cp. / support-files/my-huge.cnf / etc/my.cnf # copy the configuration file Note if there is a my.cnf directly overwritten by default in the / etc directory, vi / etc/my.cnf # can edit the configuration file In the [mysqld] section, add the following line datadir = / data/mysql # add MySQL database path: wq! # Save exit. / scripts/mysql_install_db-- user=mysql # generate mysql system database cp. / support-files/mysql.server / etc/rc.d/init.d/mysqld # add Mysql to the system startup chmod 755 / etc/rc.d/init .d / mysqld # increase execution permissions chkconfig mysqld on # set boot vi / etc/rc.d/init.d/mysqld # Edit basedir = / usr/local/mysql # MySQL program installation path datadir = / data/mysql # MySQl database storage directory / etc/init.d/mysqld start # start vi / etc/profile # The mysql service adds the system environment variable to the end by adding the following line: export PATH=$PATH:/usr/local/mysql/bin: wq! # Save exit

The following two lines link the library file of mysql to the default location of the system. You don't have to specify the library file address of mysql when compiling software like PHP.

Ln-s / usr/local/mysql/lib/mysql / usr/lib/mysqlln-s / usr/local/mysql/include/mysql / usr/include/mysql login mysql changes root password (disconnect remote connection and reconnect if login or mysql command cannot be found) mysql-u rootmysql > SET PASSWORD FOR 'root'@'localhost' = PASSWORD (' 10idccom'); / etc/init.d/mysqld restart # restart

At this point the mysql installation is complete

Install pcrecd / usr/local/src mkdir / usr/local/pcre # create installation directory tar zxf pcre-8.36.tar.gz cd pcre-8.36. / configure-- prefix=/usr/local/pcre # configure make make install install nginxcd / usr/local/src groupadd www # add www group useradd-g www www-s / sbin/nologin # create nginx running account www and join www group www is not allowed Users directly log in to the system tar zxf nginx-1.6.3.tar.gztar zxf openssl-1.0.0d.tar.gz cd nginx-1.6.3. / configure-- prefix=/usr/local/nginx-- without-http_memcached_module-- user=www-- group=www-- with-http_stub_status_module-- with-pcre=/usr/local/src/pcre-8.36-- with-openssl=/usr/local/src/openssl-1.0.0d-- with-http_ssl_module

Note:-with-pcre=/usr/local/src/pcre-8.30 points to the path to which the source package is extracted, not the path to be installed, otherwise an error will be reported.

The last two are to enable ssl. If it is not enabled, you do not have to add it.

Make make install / usr/local/nginx/sbin/nginx # start nginx vi / etc/rc.d/init.d/nginx # set nginx boot

Edit the startup file to add the following

#! / bin/bash # nginx Startup script for the Nginx HTTP Server # it is v.0.0.2 version. # chkconfig:-85 15 # description: Nginx is a high-performance web and proxy server. # It has a lot of features, but it's not for everyone. # processname: nginx # pidfile: / var/run/nginx.pid # config: / usr/local/nginx/conf/nginx.conf nginxd=/usr/local/nginx/sbin/nginx nginx_config=/usr/local/nginx/conf/nginx.conf nginx_pid=/usr/local/nginx/logs/nginx.pid RETVAL=0 prog= "nginx" # Source function library. . / etc/rc.d/init.d/functions # Source networking configuration. . / etc/sysconfig/network # Check that networking is up. [${NETWORKING} = "no"] & & exit 0 [- x $nginxd] | | exit 0 # Start nginx daemons functions. Start () {if [- e $nginx_pid]; then echo "nginx already running...." Exit 1 fi echo-n $"Starting $prog:" daemon $nginxd-c ${nginx_config} RETVAL=$? Echo [$RETVAL = 0] & & touch / var/lock/subsys/nginx return $RETVAL} # Stop nginx daemons functions. Stop () {echo-n $"Stopping $prog:" killproc $nginxd RETVAL=$? Echo [$RETVAL= 0] & & rm-f / var/lock/subsys/nginx / usr/local/nginx/logs/nginx.pid} reload () {echo-n $"Reloading $prog:" # kill-HUP `cat ${nginx_pid} `killproc $nginxd-HUP RETVAL=$? Echo} # See how we were called. Case "$1" in start) start;; stop) stop;; reload) reload;;restart) stopstart;; status) status $prog RETVAL=$? *) echo $"Usage: $prog {start | stop | restart | reload | status}" exit 1 esac exit $RETVAL #: wq! # Save and exit

Return to command line operation

Chmod 775 / etc/rc.d/init.d/nginx # Grant file execution permissions chkconfig nginx on # set boot / etc/rc.d/init.d/nginx restart # restart installation libmcryptcd / usr/local/src tar zxf libmcrypt-2.5.7.tar.gz # decompress cd libmcrypt-2.5.7. / configure # configure make # compile make install # install phpcd / usr/local/src tar zxf php-5.5.38.tar.gzcd php-5.5.38 mkdir-p / usr/local/php5 # establish the php installation directory. / configure-- prefix=/usr/local/php5-- with-config-file-path=/usr/local/php5/etc-- with-mysql=/usr/local/mysql-- with-mysqli=/usr/local/mysql/bin/mysql_config-- with- Mysql-sock=/tmp/mysql.sock-with-pdo-mysql=/usr/local/mysql-with-gd-with-iconv-with-zlib-enable-xml-enable-magic-quotes-enable-safe-mode-enable-bcmath-enable-shmop-enable-sysvsem-enable-inline-optimization-with-curlwrappers-enable-mbregex enable-fpm enable-mbstring enable-ftp enable-gd-native-ttf with-openssl -enable-pcntl-- enable-sockets-- with-xmlrpc-- enable-zip-- enable-soap-- without-pear-- with-gettext-- enable-session-- with-mcrypt-- with-curl-- with-jpeg-dir-- with-freetype-dirmake # compile make install # installation

Make: * [ext/fileinfo/libmagic/apprentice.lo] Error 1 if the memory is less than 1g.

Add-disable-fileinfo to. / configure

Cp php.ini-production / usr/local/php5/etc/php.ini # copy the php configuration file to the installation directory rm-rf / etc/php.ini # Delete the configuration file that comes with the system ln-s / usr/local/php5/etc/php.ini / etc/php.ini # add the soft link cp / usr/local/php5/etc/php-fpm.conf.default / usr/local/php5/etc/php- Fpm.conf # copy template file for php-fpm configuration file vi / usr/local/php5/etc/php-fpm.conf # Edit pid = run/php-fpm.pid # cancel the previous semicolon user = www # set the php-fpm running account to www group = www # set the php-fpm running group to www cp / usr/local/src/php-5.5.38/sapi/fpm/ Init.d.php-fpm / etc/rc.d/init.d/php-fpm # set php-fpm boot copy php-fpm to boot directory chmod + x / etc/rc.d/init.d/php-fpm # add execution permissions chkconfig php-fpm on # set boot / etc/init.d/php-fpm startvi / usr/local/php5/etc/php.ini # Edit configuration file

find

Disable_functions =

Modify to

Disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin Posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname

List the functions that PHP can disable if some programs need to use this function can be deleted and undisabled.

find

; date.timezone =

Modify to

Date.timezone = PRC # set time zone

find

Expose_php = On

Modify to

Expose_php = OFF # suppresses the display of php version information

PS may report an error that UNDEFINED REFERENCE TO `LIBICONV_OPEN cannot compile PHP LIBICONV in the process of compiling PHP.

Configuration nginx supports phpmkdir / data/wwwvi / usr/local/nginx/conf/nginx.conf # Editing configuration file user www www; # first line user uncomment, modify Nginx run group to www www must be the same as user,group configuration in / usr/local/php5/etc/php-fpm.conf, otherwise php run error index server {listen 80; server_name localhost Location / {root / data/www/; index index.php index.html index.htm;} error_page 500 502 503 504 / 50x.hml; location = / 50x.html {root html;} location ~\ .php$ {root / data/www/ Fastcgi_pass 127.0.0.1 fastcgi_pass 9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME / data/www/$fastcgi_script_name; include fastcgi_params;}}

Note to uncomment part of the location in FastCGI server, and note that the parameter of the fastcgi_param line is changed to / data/webroot/ (this is the absolute path to the root of the site) $fastcgi_script_name

/ etc/init.d/nginx restart # restart nginx

test

Vim / data/www/index.php

Http://ip/index.php

=

Rm-rf / data/www/index.php

The test steps can be omitted. Install forum and phpmyadmin after testing.

Unzip Discuz_X3.3_SC_UTF8 mv upload/ data/www upload is cd / data/www/chown-R www:www upload/* cd / usr/local/srctar zxf phpMyAdmin-4.6.6-all-languages.tar.gz-C / data/www/cd / data/wwwmv phpMyAdmin-4.6.6-all-languages phpmyadminvi / usr/local/nginx/conf/nginx.conf server {listen 80; server_name localhost extracted from Discuz_X3.3_SC_UTF8. Location / {root / data/www/upload; index index.php index.html index.htm;} error_page 500 502 503 504 / 50x.hml; location = / 50x.html {root html;} location ~\ .php$ {root / data/www/upload Fastcgi_pass 127.0.0.1 data/www/upload/$fastcgi_script_name; include fastcgi_params; 9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME / data/www/upload/$fastcgi_script_name; include fastcgi_params;}} server {listen 81; server_name localhost; location / {root / data/www/phpmyadmin Index index.php index.html index.htm;} error_page 500 502 503 504 / 50x.html; location = / 50x.html {root html;} location ~\ .php$ {root / data/www/phpmyadmin; fastcgi_pass 127.0.0.1 50x.html 9000; fastcgi_index index.php Fastcgi_param SCRIPT_FILENAME / data/www/phpmyadmin/$fastcgi_script_name; include fastcgi_params;}} / etc/init.d/nginx restart installation forum http://ip login phpmyadmin http://ip:81 mysql account: root password 10idccom

=

Yum install-y vsftpd

Mkdir-p / data/ftp

Chmod-R 755 / data/ftp

Useradd-s / sbin/nologin admins

Passwd admins

Vi / etc/vsftpd/vsftpd.conf

Anonymous_enable=no

Add on the last line

Local_root=/data/ftp

/ etc/init.d/vsftpd start

~ or ~ ~

# yum install-y vsftpd# useradd-d / data/ftp-s / sbin/nologin-M admins-g ftp# passwd admins# mkdir-p / data/ftp# chmod-R 755 / data/ftp# vi / etc/vsftpd/vsftpd.confanonymous_enable=no ascii_upload_enable=YESascii_download_enable=YES chroot_list_enable=YESchroot_list_file=/etc/vsftpd/chroot_list use_localtime=YES add # vi / etc/vsftpd/chroot_listadmins# / etc/init.d/vsftpd Restartftp access address ftp://ip account: admins password: 10idccom

It is not recommended to test on a web page. It is recommended to test directly with ftp client tools.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report