Build LNMP environment with Linux environment

Source: Internet
Author: User

compiling and installing the LNMP environmentPreparation software: nginx1.10.3+php-5.5.12+mariadb10.0.8 (the yum installation used in this database)

If you need to compile the installation can give me a message, I follow up again released!

Dependency packages have Yum installed mariadb database yum-y install mariadb* start database Systemctl start mariadb Modify root password grant all privileges on * * to ' r Oot ' @ ' localhost ' identified by ' root ' with grant option;grant all privileges on * * to ' root ' @ '% ' identified by ' root ' wit H Grant Option;flush privileges; second, install NGINX1, install dependent packageYum install-y pcre pcre-devel OpenSSL openssl-devel gcc-c++2. Create the user running the processGroupadd Nginxuseradd-g nginx-s/bin/nologin nginx3. Compile and install Nginxmy software here is in the MyApp directory.TAR-ZXVF nginx-1.10.3.tar.gz #解压到当前目录cd nginx-1.10.3./configure--prefix=/usr/local/nginx--user=nginx--group=nginx --with-http_ssl_module--with-pcre--with-http_gzip_static_module--without-http_gzip_module--with-http_stub_ Status_modulemakemake Install4, Startup nginxcd/usr/local/nginx/sbin./nginx5, authentication: Browser accessHTTP://IPThird, compile and install PHP1, install the dependent package yum-y install libxml2* Curl curl-devel libpng-devel libpng openldap openldap-devel freetype Freetype-dev El Libjpeg-devel Libpng-devel2, compiled and installed PHPTAR-XJF PHP-5.5.12.TAR.BZ2CD php-5.5.12./configure^c-prefix=/usr/local/php-- with-bz2--with-curl--enable-ftp--enable-sockets--disable-ipv6--with-gd--with-jpeg-dir=/usr/local--with-png-dir =/usr/local--with-freetype-dir=/usr/local--enable-gd-native-ttf--with-iconv-dir=/usr/local--enable-mbstring-- Enable-calendar--with-gettext--with-libxml-dir=/usr/local/--with-zlib--with-pdo-mysql=mysqlnd--with-mysqli= Mysqlnd--with-mysql=mysqlnd--enable-dom--enable-xml--enable-fpm--with-libdir=lib64makemake testmake Install3, Modify PHP file cp/myapp/php-5.5.12/php.ini-production/usr/local/php/etc/php.inicp/usr/local/php/etc/ Php-fpm.conf.default Php-fpm.conf4, start php/usr/local/php/sbin/php-fpm Check if startup is successful NETSTAT-LNTP | grep php-fpm Display TCP 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 77087/php-fpm:mast Four, integrated nginx support PHP1, modify nginx configuration file Vi/usr/local/nginx/conf/nginx.conf[[email protected] conf]# Cat nginx.conf | Grep-v "#" user Nginx nginx;worker_processes 1;events {worker_connections 1024;} HTTP {include mime.types; Default_type application/octet-stream; Log_format main ' $remote _addr-$remote _user [$time _loc AL] "$request" $status $body _bytes_sent "$http _referer" "$http _user_agent" "$http _x_forwarded_for"; Access_log Logs/access.log Main; Sendfile on; Keepalive_timeout 65; server {listen; server_name localhost; charset utf8; location/{root HTML; index index.html index.htm index.php;} E Rror_page 502 503 504/50x.html; Location =/50x.html {root HTML,} location ~ \.php$ {root html; fastcgi_pass 127.0.0.1:9000; Fastcgi_index index.php; F Astcgi_param script_filename $document _root$fastcgi_script_name; Include Fastcgi_params; }}2, create index.php file Test Cd/usr/local/nginx/htmlvi index.php[[email protected] html]# cat index.php <?php $link = Mysql_connect ("172.16.20.112", "root", "root"); if (! $link) echo "MySQL database connectionFailure! "; else echo "MySQL database connection succeeded!!"; Phpinfo ();? > Save Exit chmod 775 index.php3, verify browser http://IP/index.php

If you have any questions, please point them out!! Thank you!!

Build LNMP environment with Linux environment

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.