Centos6.5 php environment (nginx + mariadb + php7), centosnginx_PHP tutorial

Source: Internet
Author: User
Centos6.5 build a php environment (nginx + mariadb + php7) and centosng.pdf. Centos6.5: set up a php environment (nginx + mariadb + php7), centosnginxphp, and write bolg for the first time. what's wrong. mariaDbvimetcyum. repos Centos 6.5 php environment (nginx + mariadb + php7), centosng.pdf

I wrote bolg for the first time in a php dish. what's wrong?

1. mariaDb

vim /etc/yum.repos.d/MariaDB.repo
[Mariadb] name = MariaDBbaseurl = http://yum.mariadb.org/5.5/centos5-x86gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDBgpgcheck=1

Sudo yum install MariaDB-server MariaDB-client
# Start MariaDB
Sudo/etc/init. d/mysql start

You can install yum by creating MariaDB. repo.

For more information about the configuration files for different linux versions, see the following link.

Https://mariadb.com/kb/zh-cn/installing-mariadb-with-yum/

Https://downloads.mariadb.org/mariadb/repositories/#mirror=opencas

2. nginx

# This command can install the development kit with one click
Yum-y groupinstall "Development Tools" "Development Libraries"

# Create a www group and a www user
Groupadd www
Useradd-g www-s/usr/sbin/nologin www

# Install Nginx

Tar zxvf nginx-1.9.9.tar.gz

Cd nginx-1.9.9.tar.gz/
./Configure -- user = www -- group = www -- prefix =/usr/local/nginx -- with-http_stub_status_module -- with-http_ssl_module
Make & make install

# Start Nginx
/Usr/local/nginx/sbin/nginx
# Test whether the configuration file is correct
/Usr/local/nginx/sbin/nginx-t

You can also use the service command to operate the nginx service as follows:

1. create a file and write the following shell script in it:

File

#!/bin/bash# nginx Startup script for the Nginx HTTP Server## 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.confnginxd=/usr/local/nginx/sbin/nginxnginx_config=/usr/local/nginx/conf/nginx.confnginx_pid=/var/run/nginx.pidRETVAL=0prog="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 1fi   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 /var/run/nginx.pid}# reload nginx service functions.reload() {    echo -n $"Reloading $prog: "    #kill -HUP `cat ${nginx_pid}`    killproc $nginxd -HUP    RETVAL=$?    echo}# See how we were called.case "$1" instart)        start        ;;stop)        stop        ;;reload)        reload        ;;restart)        stop        start        ;;status)        status $prog        RETVAL=$?        ;;*)        echo $"Usage: $prog {start|stop|restart|reload|status|help}"        exit 1esacexit $RETVAL

2. copy the file to the/etc/init. d Directory.

# Cp./nginx/etc/init. d

3. modify this file as executable permissions

# Chmod + x/etc/init. d/nginx

4. add the executable file to the service.

# Chkconfig -- add nginx

Then you can use the service command to manage it!

3. php

# Update the required module before installation # yum-y install libjpeg-devel libpng-devel freetype-devel libxml2 libxml2-devel mysql pcre-devel # wget https://downloads.php.net/~ab/php-7.0.0RC1.tar.gz# Tar zxvf php-7.0.0RC1.tar.gz # cd php-7.0.0RC1 #. /configure -- prefix =/usr/local/php \ -- with-curl \ -- with-freetype-dir \ -- with-gd \ -- with-gettext \ -- with-iconv-dir \ -- with-kerberos \ -- with-libdir = lib64 \ -- with-libxml-dir \ -- with-mysqli \ -- with-openssl \ -- with-pcre-regex \ --- pdo-mysql \ -- with-pdo-sqlite \ -- with-pear \ -- with-png-dir \ -- with-xmlrpc \ -- with-xsl \ -- with-zlib \ -- enable -fpm \ -- enable-bcmath \ -- enable-libxml \ -- enable-inline-optimization \ -- enable-gd-native-ttf \ -- enable-mbregex \ -- enable-mbstring \-- enable-opcache \ -- enable-pcntl \ -- enable-shmop \ -- enable-soap \ -- enable-sockets \ -- enable-sysvsem \ -- enable-xml \ -- enable-zip # compile install # make & make install # configuration file # cp php. ini-development/usr/local/php/lib/php. ini # cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf # cp/usr/local/php/etc/php-fpm.d/www. conf. default/usr/local/php/etc/php-fpm.d/www. conf # cp-R. /sapi/fpm/php-fpm/etc/init. d/php-fpm # Start #/etc/init. d/php-fpm # check whether ps aux is enabled | grep php

Modify nginx configuration and listen to *. php files

# Vim/usr/local/nginx/conf/nginx. conf

The simple configuration is as follows:

User www; worker_processes 10; # error_log/data/logs/nginx_error.log crit; # pid logs/nginx. pid; # Specifies the value for maximum file descriptors that can be opened by this process. worker_rlimit_nofile 51200; events {use epoll; worker_connections 51200;} http {include mime. types; default_type application/octet-stream; # charset gbk; server_names_hash_bucket_size 128; client_header_buffer_size 32 k; lar Listen 4 32 k; # listen 8 m; server_tokens off; expires 1 h; sendfile on; tcp_nopush on; keepalive_timeout 60; tcp_nodelay on; error_page 404/404 .jpg; limit 20; limit 30; fastcgi_read_timeout 120; fastcgi_buffer_size 256 k; fastcgi_buffers 8 256 k; fastcgi_busy_buffers_size 256 k; fastcgi_temp_file_write_size 256 k; fastcgi_temp_path/dev Hm; gzip on; gzip_min_length 2048; gzip_buffers 4 16 k; gzip_http_version 1.1; gzip_types text/plain text/css application/xml application/x-javascript; log_format access' $ remote_addr-$ remote_user [$ time_local] "$ request" ''$ status $ body_bytes_sent" $ http_referer "'' "$ http_user_agent" $ http_x_forwarded_for '; server {listen 80; server_name localhost; # charset KOI8-R; # access_log logs/host. acces S. log main; location/{root html; index index.html index.htm index. php;} # rewrite index. php/^ (. *) $ idex. php? S =/$1 last; # error_page 404/404 .html; # redirect server error pages to the static page/50x.html # error_page 500 502 503 x.html; location =/50x.html {root html ;} location ~ \. Php $ {fastcgi_pass 127.0.0.1: 9000; fastcgi_index index. php; include fastcgi. conf ;}} ####################################### include block_ips.conf; # include vhost /*. conf; # force the domain name to access the conf # server {# listen 80 default; # server_name _; # return 404 ;#}} of the corresponding domain name ;#}}

Last phpinfo (), succeeded

Http://www.bkjia.com/PHPjc/1086846.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1086846.htmlTechArticleCentos 6.5 build php environment (nginx + mariadb + php7), centosng?php dish one, the first write bolg, what is wrong, please also greatly pointed out 1. mariaDb vim/etc/yum. repos...

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.