Linux Network Servers nginx, PHP-FPM, MySQL Rostislav Skudnov, Timo Jääskeläinen.

Slides:



Advertisements
Similar presentations
WordPress Installation for Beginners Sheila Bergman
Advertisements

Shining A Light on Open Source Software: Going Beyond LAMPP Serving Web Content Using Open Source Software.
FIRST SESSION - XAMPP Jeongmin Lee.  Jeongmin Lee  CS  PHD  Machine Learning, AI  Web System Development.
What all is there Inside the Apache web server. These slides are part of study material of LAMP course. Course conducted by Prof Rocky Jagtiani – Technical.
December, 2008 CS-591 Securing Servers: International Capture the Flag 1 Nadine Sundquist CS591-F2008 University of Colorado, Colorado Springs Dr. C. Edward.
Dan Fleck.  WAMP – Windows Apache MySQL PHP -  LAMP – Linux Apache MySQL PHP ◦ There are.
Prime’ Senior Project. Presentation Outline What is Our Project? Problem Definition What does our system do? How does the system work? Implementation.
1 Configuring Internet- related services (April 22, 2015) © Abdou Illia, Spring 2015.
LIS654lecture 3 omeka installation and system overview start Thomas Krichel
20-753: Fundamentals of Web Programming 1 Lecture 11: Web Server Case Study Fundamentals of Web Programming Lecture 11: Web Server Case Study.
Chapter Apache Installation on Linux. Acknowledgement The contribution made by Darrin Morison is acknowledged.
Apache Installation by Jack Davis. Web Servers The Apache HTTP Server is the most widely used web server on the Internet. Apache is fast, free, and full-featured.
What is it? –Large Web sites that support commercial use cannot be written by hand What you’re going to learn –How a Web server and a database can be used.
Creating WordPress Websites. Creating a site on your computer Local server Local WordPress installation Setting Up Dreamweaver.
Chapter Apache Installation on Linux. Acknowledgement The contribution made by Darrin Morison is acknowledged.
Chapter Apache Installation in Linux- Mandrake. Acknowledgment The following information has been obtained directly from
The Web Server Every web site (the collection of html/css files, data files, scripts and other files) must be stored on a web server The term web server.
Julien Thibault / Phil Brewster / Kristina Doing-Harris
Chapter 22 Web Hosting and Internet Servers Xuanxuan Su.
Lecture 8 Configuring a Printer-using Magic Filter Introduction to IP Addressing.
SFX System Administration SFX Training, SFX File Structure The SFX installation is contained in one directory: /exlibris/sfx_ver/sfx_version_3.
Securing LAMP: Linux, Apache, MySQL and PHP Track 2 Workshop PacNOG 7 July 1, 2010 Pago Pago, American Samoa.
Introducing LAMP: Linux, Apache, MySQL and PHP Track 2 Workshop PacNOG 7 July 1, 2010 Pago Pago, American Samoa.
SYST Web Technologies SYST Web Technologies Installing a Web Server (XAMPP)
PHP and MySQL Week#1  Course Plan.  Introduction to Dynamic Web Content.  Setting Up Development Server Eng. Mohamed Ahmed Black 1.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Linux Operations and Administration
Intro to PHP at Winthrop CSCI 297 Scripting Languages Day One.
Web Server Configuration Alokes Chattopadhyay Computer & Informatics Centre IIT Kharagpur.
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Apache Server The Apache Server Apache is a WWW server that implements the HTTP protocol. Apache runs as a daemon. This means that it is a resident.
Web Servers1-1 Web Servers Xingquan (Hill) Zhu
Server works - HTML5 - CSS3 - Bootstrap 3.x. Likipe Servers Dev ServerProduction Server TypeShared HostVirtual Private Server Urlweb1.likipe.se/web2.likipe.se“Real.
An introduction to Apache. Different Types of Web Servers Apache is the default web server for may Unix servers. IIS is Microsoft’s default web server.
1 John Magee 9 November 2012 CS120 Lecture 17a: Publishing Web pages.
System Administration NFS & Web Servers. NFS SERVER.
2nd Semester Meeting 2 Matt Bernstein, Paul Capelli, Jared Segal January 22, 2008.
Drupal Jumpstart Information Systems 337 Prof. Harry Plantinga.
Apache and... Virtual Hosts ---- aliases mod_rewrite ---- htaccess AFNOG 11 Kigali, Rwanda May 2010 Dorcas Muthoni Courtesy: Hervey Allen.
Copyright (c) by CNAPTICS Corporation. All rights reserved.1 INFO Oracle Database 11g: Administration II Presented By: Marc S. Paller,
1 Week 6 The lynx browser Apache Web Server John Wang With materials courtesy of Inge Mclaurin.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Apache, MySQL and PHP Installation and Configuration Chapter 1 Apache Installation and Configuration.
Web Database Programming Week 7 Session Management & Authentication.
1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development.
.htaccess Apache server directives BTM 395: Internet Programming.
Linux Services Configuration
PHP “Personal Home Page Hypertext Pre-processor” (a recursive acronym) Allows you to create dynamic web pages and link web pages to a database.
Apache, MySQL and PHP Installation and Configuration Chapter 2 MySQL Installation and Configuration.
Web Server Apache PHP HTTP Request User types URL into browser Address resolved if nec. We use directly Most browsers request.
Web programming Part 1: environment 由 NordriDesign 提供
How Web Database Architectures Work CPS181s April 8, 2003.
Installation of PHP5 Objectives –Install PHP5 with support for Apache and MySQL Contents –Installing latest dependencies LibXML & LibSLT –Compiling and.
Speeding Up Alfresco and Share using Nginx Reverse/Caching Frontend Proxy Ishara Fernando Senior Linux Systems Administrator.
Multi-Domain Hosting CPTE 212 “Missing Slides” for 1/22/2015 John Beckett.
Building Your Own Website Using:. Install & configure LAMP. Download WordPress and run it as a local website on your Raspberry Pi. Configure WordPress.
WordPress and Etherpad with BlueMix and Docker. Our aim is to run on BlueMix containers (now in beta) these two famous services In the BlueMix dashboard,
Apache Web Server v. 2.2 Reference Manual Chapter 2 Starting Apache.
PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used, free, and efficient alternative.
L.A.M.P. İlker Korkmaz & Kaya Oğuz CS 350. Why cover a lecture on LAMP? ● Job Opportunities – There are many hosting companies offering LAMP as a web.
©2012 der.hans, CC BY-SA 3.0 unported Nginx: Proxy Your Web Servers for Better Performance der.hans SCaLE 10x, 2012Jan21 Hilton LAX, Los Angeles A.
Installing iHRIS Install iHRIS Manage on an Ubuntu System
2nd year Computer Science & Engineer
Introduction to Dynamic Web Programming
Apache Server.
Unix System Administration
INSTALLING AND SETTING UP APACHE2 IN A LINUX ENVIRONMENT
Intro to PHP at Winthrop
Configuring Internet-related services
SiteBuilder 2 Introduction.
Presentation transcript:

Linux Network Servers nginx, PHP-FPM, MySQL Rostislav Skudnov, Timo Jääskeläinen

What is nginx? This Russian guy has created the 3rd most popular Web server Used on WordPress, Hulu, SourceForge, and many more... Source: b_server_survey.html Igor Sysoev

What is PHP-FPM? FastCGI Process Manager for PHP Another Russian guy, who wasn't satisfied with existing PHP FastCGI, and has created FPM in his spare time In PHP core since Andrei Nigmatulin

Classic LAMP vs nginx + PHP-FPM LAMP One Apache process per each connection PHP is compiled into Apache and launches again on every request High memory and CPU consumption in a high load environment nginx + PHP-FPM A few nginx processes handle thousands of connections PHP processes are spawned when necessary; already spawned ones are reused Low memory and CPU consumption

Installing nginx wget tar -xzf nginx tar.gz cd nginx /configure --with-http_ssl_module... make make install Create init script in /etc/init.d/nginx

Installing PHP-FPM wget tar -xzf php tar.gz cd php /configure --enable-fpm --with-mysql --with-mcrypt --with-curl --with- mysqli --with-mysql-sock --with-pdo-mysql --with-gd --with-zlib make make install Create init script in /etc/init.d/php-fpm

Configuring nginx less /usr/local/nginx/conf/nginx.conf user www-data; worker_processes 1; error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; gzip on; include /usr/local/nginx/sites-enabled/*; }

The add and remove PHP scripts addclient.php: Creates Linux user with auto generated password Writes Nginx configuration file Writes FPM configuration file Creates a placeholder web page for the new user Creates MySQL user and database remclient.php: Reverse action – removes everything including user dir

Creating Linux user The PHP script: Generates a random password Makes sure that user name and domain names are correct (RegEx) Sends command to create the user // Creating Unix user, default group www-data passthru("useradd -m -K UMASK=027 -s /bin/bash -c '$domain' -p $passwordCrypted $username", $res); passthru("usermod -a -G $username www-data"); In the end script checks whether the user was created successfully or not

Generating Nginx and FPM configs The PHP script: Uses pre-written templates for both configs, replacing username and domain info Copies the config files into nginx available-sites and fpm config directory Creates a link into Nginx sites-enabled

Configuring nginx - vhost template less ~/hostadmin/nginx_tpl.txt server { listen 80; server_name [[domain]]; root /home/[[user]]/www/; access_log /home/[[user]]/logs/access.log; error_log /home/[[user]]/logs/error.log; location / { try_files $uri index index.html index.php; } location ~ \.php$ { include /usr/local/nginx/conf/fastcgi.conf; fastcgi_pass unix:/tmp/[[user]].sock; fastcgi_index index.php; } { rewrite ^/(.*)$ /index.php?q=$1 last; }

Configuring PHP-FPM - vhost template less ~/hostadmin/fpm_tpl.txt [[[user]]] listen = /tmp/[[user]].sock user = [[user]] group = [[user]] pm = dynamic pm.max_children = 50 pm.start_servers = 1 pm.min_spare_servers = 1 pm.max_spare_servers = 35 php_admin_value[error_log] = /home/[[user]]/logs/fpm-php.log

Creating a placeholder web page The PHP script: Uses pre-written HTML and replacing user name and domain name Copies the new HTML file into user’s www directory Sets permissions

Creating the MySQL database The PHP script uses three simple MySQL: Create database: mysql_query("create database $user") Create user with generated password and all privileges to his/her database: mysql_query("grant all privileges on $user.* to identified by '$pass'")