Google Plus

How to install LEMP on Fedora 17

Written by Mel Kham on . Posted in Fedora, Frequently Asked Questions, Linux tutorials

In this post we will see  a compatible alternative to the “LAMP” (Linux, Apache, MySQL, and PHP) , known as “LEMP”  (Linux, Nginx, MySQL, PHP) . The LEMP replaces the Apache web server component with nginx  which can increase the ability of the server to scale in response to demand.

1- Installing MySQL

First we install MySQL 5 like this:

yum install mysql mysql-server

- Create the system startup links for Mysqld  and start it

systemctl enable mysqld.service
systemctl start mysqld.service

- Set  root  MySQL password  with

mysql_secure_installation
#or
mysqladmin -u root password “newpassword”

2- Installing Nginx

Before  to install Nginx  you have  to remove  any   other  apache  application with  yum  remove  httpd

Nginx is available as a package for Fedora 17

yum install nginx

- Create the system startup links for nginx and start it:

systemctl enable nginx.service
systemctl start nginx.service

Now  open the  browser  and  open  http://ip

3- Install php5  PHP-FPM 5.4

 yum install php php-fpm php-common

-Install Php modules

yum install install php-pecl-apc php-cli php-pear php-pdo php-mysql php-pgsql php-pecl-mongo
php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml

- Now    edit  /etc/php.ini  and  set.

date_timezone = "Europe/Amsterdam"
cgi.fix_pathinfo=0

- Create the system start-up links for php-fpm and start it:

systemctl enable php-fpm.service
systemctl start php-fpm.service

Now  edit  nginx  to  run php  pages

 vi /etc/nginx/conf.d/default.conf

and  make it like this :

###################################################
 server {
 listen       80;
 server_name  _;
#charset koi8-r;
#access_log  logs/host.access.log  main;
location / {
root   /usr/share/nginx/html;
index  index.php index.html index.htm;
}
error_page  404              /404.html;
location = /404.html {
root   /usr/share/nginx/html;
}
# redirect server error pages to the static page /50x.html
#
error_page   500 502 503 504  /50x.html;
location = /50x.html {
root   /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
#    proxy_pass   http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
 #
 #location ~ \.php$ {
 #    root           html;
 #    fastcgi_pass   127.0.0.1:9000;
 #    fastcgi_index  index.php;
 #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
 #    include        fastcgi_params;
 #}
 location ~ \.php$ {
 try_files $uri =404;
 root           /usr/share/nginx/html;
 fastcgi_pass   127.0.0.1:9000;
 fastcgi_index  index.php;
 fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
 include        fastcgi_params;
 }
 # deny access to .htaccess files, if Apache's document root
 # concurs with nginx's one
 #
 #location ~ /\.ht {
 #    deny  all;
 #}
 location ~ /\.ht {
 deny  all;
 }
 }
 ######################################################################################

Now  check  phpinfo  page
edit /usr/share/nginx/html/info.php
and  add

<?php
 phpinfo();
 ?>

save and exit

Now  open  http:/ip/info.php

4-Install  PhpMyAdmin

If  you you want  topmake phpmyadmin working  with  Nginx   dont forget to add this  to /etc/nginx/conf.d/default.conf

Alias for phpMyAdmin (after the commented section about PHP)

location /phpMyAdmin {
 alias   /usr/share/phpMyAdmin;
 index  index.php index.html index.htm;
 }

PHP Configuration for phpMyAdmin

location ~ /phpMyAdmin/.*\.php$ {
 fastcgi_pass   127.0.0.1:9000;
 fastcgi_index  index.php;
 fastcgi_param  SCRIPT_FILENAME  /usr/share/$uri;
 fastcgi_intercept_errors on;
 include        fastcgi_params;
 }

Reload  Nginx  anad  enjoy

For questions please refer to our Q/A forum at : http://ask.unixmen.com

Mel Kham

Founder of Unixmen, Living in Amsterdam. Am working in my free time to help people to understand the Opensource and to explain them in easy way how to make the fist steps to the the light. Working day and night with my Co-founder Zinovsky to keep this website live even with less resources.
  • aiphee

    What is diff between Nginx and Apache? I use cherokee because of nice web interface.

    • Kage Edwards

       NGINX is event-based – it has better performance and server configuration itself does re-writing vs regular expressions through mod_rewrite in .htaccess

      I was quite overwhelmed by the idea of switching from Apache, but within the first hour, I already got the hang of the basics of NGINX configuration and love it…

      Not the best description I know, but NGINX is worth looking into imo. :)

      • Ali Tazik

         Hi bro.
        How can I change the root directory in nginx??
        Now my root directory is /usr/share/nginx/html.
        I want change it, like ~/web

Like us on Facebook

This week Top Posts

Write for us

Recent Comments

pigmej

|

Just one thing:

What about pep8 in your python code ? How can you give ‘tutorials’ on quite popular website, of such a bad quality ?

Amit Rai

|

I just renamed shared.xml and it logged in and created a new shared.xml.

DB Griffin

|

Larry Page is not being completely honest! The manner in which the PRISM program/project works does not need access from company administrators or owners, so called “direct access”; the access to the information is already there. These tech company CEOs take for granted the actual intelligence of most end users of their products. All it takes is a little digging and reading to go from ignorant to informed on these things especially on exactly how the internet works/functions in the U.S.A. I find Larry Page’s remarks just as laughable as Al Gore’s claim to “inventing” the internet/world wide web!

If you, as an end user, are reading this post; I challenge you to research these matters yourself. It really is quite simple with all the “information sites” that exist on the web today ie Wikipedia, & other online encyclopedias that actually list source material, as well as highly respected tech sites and blogs that also list their source material. Be warned: this is only the tip of the iceberg and these tech CEOs know and understand this; they are scrambling in attempt to perform DAMAGE CONTROL to save the company and what little trust thay have left from their products end users/consumers.

Am I a skeptic? I believe someone has to be or needs to be at this point in time! If your not just a little skeptical of the government, tech companies, and the people that are in charge of these agencies and companies; you need to be, even if just a little skeptic. For your own personal protection and security! I know I was a part of this community for over 14 years!

Anders Jackson

|

As I understand it so do VLC use same encoders as ffmpeg. And yes, there are less code that can break when you use command line instead of a graphical UI.

And may I ask what mono has to do with VLC? *facepalm*

Anders Jackson

|

Just some thoughts about Java.

OpenJDK7 are now THE Java implementation and Oracles are just one more of the reimplementations. So you should not need to install Oracles version.

And you really don’t need to remove the OpenJDK7 installation to also have Sun Java JDK 7. Just run

sudo update-java-alternatives –list

and select which java you want to have as default java of all that is installed.

And if you want to run a program with one special version, check manpage for java-wrappers how to do that.

man java-wrappers

so you can run java program rasterizer like this:

JAVA_FLAVOR=openjdk rasterizer
JAVA_ARGS=-Xmx80m rasterizer

JAVA_BINDIR=/usr/share/

etc

 
IDG Tech Network
Copyright © 2008-2013 Unixmen.com .
Maintained by Anblik .