Nginx Installation Configuration

Source: Internet
Author: User
Tags myadmin

    1. Yum Source Installation

Install dependent packages

Yum Install Pcre-devel zlib-devel openssl-devel

Install the required services

Yum-y install nginx php-mysql mysql mariadb-server php-fpm

Create an Nginx startup user

Useradd-r www

Modify the Nginx configuration nginx.conf

User www; Worker_processes Auto;

To modify the startup user of PHP-FPM

user = www Group = www

Create a Session Directory for PHP-FPM

[Email protected] nginx]# mkdir/var/lib/php/session/[[email protected] nginx]# chown-r www.www/var/lib/php/session/

Start the MARIADB service

[Email protected] vhost1]# systemctl start mariadb.service [[email protected] vhost1]# Systemctl enable Mariadb.service Boot up

Create the required libraries

MariaDB [(None)]> CREATE DATABASE wps; Query OK, 1 row Affected (0.00 sec) MariaDB [(none)]> GRANT all on wps.* to ' wps_user ' @ ' 192.168.%.% ' identified by ' Wps_ Pass '; Query OK, 0 rows Affected (0.00 sec) MariaDB [(None)]> FLUSH privileges; Query OK, 0 rows Affected (0.00 sec

Open PHP-FPM Service

[[email protected] conf.d]# systemctl start php-fpm.service[[email protected] conf.d]# Systemctl enable Php-fpm.service/ /boot up created symlink from/etc/systemd/system/multi-user.target.wants/php-fpm.service to/usr/lib/systemd/system/ Php-fpm.service.

Configuring Nginx Virtual Host Wps.conf

[[email protected] conf.d]# cat wps.conf server {         listen 80;        server_name  www.runner.vip;        location / {                 root /apps/vhost1/wordpress;         }        index   index.php index.html index.htm;        location ~  \.php$ {                 root           /apps/vhost1/wordpress;                 fastcgi_pass    127.0.0.1:9000;                fastcgi_index   index.php;                 fastcgi_param  script_filename  /apps/vhost1/wordpress$fastcgi_script_name;         #需要指定我们指定存放php程序网站的路径                  include        fastcgi_ params;        }}

  Configure SSL Virtual host ssl.conf

[[email protected] conf.d]# cat ssl.conf server {         listen       443 ssl;         server_name  myadmin.runner.vip;         ssl_certificate      /etc/nginx/ssl/nginx.crt;    # Certificate requested from CA         ssl_certificate_key  /etc/nginx/ssl/ httpd.key;             #私钥          ssl_session_cache    shared:SSL:1m;                                #ssl会话共享缓存, 1 minutes         ssl_ Session_timeout  5m;                                           #ssl会话超时时间5分钟         ssl_ciphers  high:! anull:! md5;        ssl_prefer_server_ciphers  on;         location / {                 root /apps/vhost2/phpmyadmin;                 index index.php index.html  index.htm;        }         location ~ \.php$ {                 root           /apps/vhost2/phpmyadmin;                 fastcgi_pass    127.0.0.1:9000;                 fastcgi_index  index.php;                 fastcgi_param  script_filename  /apps/vhost2/phpmyadmin$ fastcgi_script_name;        #需要指定我们指定存放php程序网站的路径                  include         fastcgi_params;        }}

An error occurred on the access page

MYADMIN.RUNNER.VIP Web page does not function properly

MYADMIN.RUNNER.VIP is currently unable to process this request.

HTTP ERROR 500


Viewing the error log

[[email protected] conf.d]# tail /var/log/php-fpm/www-error.log [29-jul-2016  08:28:22 utc] php fatal error:  call to undefined function  Mb_detect_encoding ()  in /apps/vhost2/phpmyadmin-4.3.5-all-languages/libraries/php-gettext/ Gettext.inc on line 177[29-jul-2016 08:28:25 utc] php fatal error:   call to undefined function mb_detect_encoding ()  in /apps/vhost2/ phpmyadmin-4.3.5-all-languages/libraries/php-gettext/gettext.inc on line 177[29-jul-2016  08:28:52 utc] php fatal error:  call to undefined function  Mb_detect_encoding ()  in /apps/vhost2/phpmyadmin-4.3.5-all-languages/libraries/php-gettext/ Gettext.inc on line 177[29-jul-2016 08:28:57 utc] php fatal error:   call to undefined funCtion mb_detect_encoding ()  in /apps/vhost2/phpmyadmin-4.3.5-all-languages/libraries/php-gettext /gettext.inc on line 177[29-jul-2016 08:31:37 utc] php fatal error:   call to undefined function mb_detect_encoding ()  in /apps/vhost2/ phpmyadmin-4.3.5-all-languages/libraries/php-gettext/gettext.inc on line 177[29-jul-2016  08:31:50 utc] php fatal error:  call to undefined function  Mb_detect_encoding ()  in /apps/vhost2/phpmyadmin-4.3.5-all-languages/libraries/php-gettext/ gettext.inc on line 177

Need to install a dependency package

[[email protected] conf.d]# yum-y install php-mbstring[[email protected] conf.d]# systemctl reload php-fpm.service Restart php- FPM Service

Open browser Access

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/85/28/wKiom1ebGofyy8XSAAIZndCJJfg094.png-wh_500x0-wm_3 -wmp_4-s_427534983.png "title=" QQ20160729-0@2x.png "alt=" Wkiom1ebgofyy8xsaaizndcjjfg094.png-wh_50 "/>


SOURCE Package Installation

Install package Group

[Email protected] ~]# yum-y groupinstall "Server Platform Development" "Development Tools"

Download Nginx Source Package

[Email protected] src]# wget http://nginx.org/download/nginx-1.10.1.tar.gz

Compile and install Nginx

./configure--prefix=/usr/local/nginx--sbin-path=/usr/sbin/nginx--conf-path=/etc/nginx/nginx.conf-- Error-log-path=/var/log/nginx/error.log--http-log-path=/var/log/nginx/access.log--pid-path=/var/run/nginx.pid- -lock-path=/var/run/nginx.lock--user=nginx--group=nginx--with-http_ssl_module--with-http_v2_module--with-http_ Dav_module--with-http_stub_status_module--with-threads--with-file-aiomake && make install

Installing the MARIADB binary package

[[email protected] src]# mkdir /data/mysql -pv[[email protected] src]#  groupadd -r -g 306 mysql[[email protected] src]# useradd -g  mysql -s /sbin/nologin mysql[[email protected] src]# chown -R  mysql.mysql /data/mysql/[[email protected] src]# mv mariadb-5.5.46-linux-x86_64  /usr/local/[[email protected] src]# ln -sv /usr/local/mariadb-5.5.46-linux-x86_64/  /usr/local/mysql '/usr/local/mysql '  ->  '/usr/local/mariadb-5.5.46-linux-x86_64/' [[Email  protected] src]# cd /usr/local/mysql/[[email protected] mysql]# ./scripts/ Mysql_install_db --user=mysql --datadir=/data/mysql[[email protected] mysql]# cp  support-files/my-large.cnf /etc/my.cnfcp: overwrite  '/etc/my.cnf '? y[[email  protected] mysql]# vim /etc/my.cnf    [mysqld]    port             = 3306    socket           = /tmp/mysql.sock    skip-external-locking     key_buffer_size = 256M    max_allowed_packet = 1M     table_open_cache = 256    sort_buffer_size = 1m     read_buffer_size = 1m    read_rnd_buffer_size =  4m    myisam_sort_buffer_size = 64m    thread_cache_ size = 8    query_cache_size= 16m    datadir =  /data/mysql    innodb_file_per_table = on    skip_name _resolve = on    thread_concurrency = 8 [[email protected] mysql]# cp  support-files/mysql.server /etc/rc.d/init.d/mysql [[email protected] mysql]# /etc/ Init.d/mysql startstarting mysql.  success!

Install the installation package that PHP-FPM depends on

Yum Install libxml2-develgd-devel freetype-devel libmcrypt-develyum install Pcre-developenssl-devel libevent-devel



This article from "Fan tea" blog, declined reprint!

Nginx Installation Configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.