Configure Nginx ( FrontEnd ) and Apache ( Backend )

Configure Nginx ( FrontEnd ) and Apache ( Backend ) Why Run Nginx and Apache Together Both nginx and apache are powerful and effective ...

Configure Nginx ( FrontEnd ) and Apache ( Backend )

Why Run Nginx and Apache Together
Both nginx and apache are powerful and effective servers. Apache currently reigns as the #1 server for websites and since its public release in 2006, nginx has taken the world by storm and is now the #2 server for active sites. The reasons for each respective server’s popularity are clear: apache’s power and nginx’s speed are well known. However, both servers do have drawbacks
apache is hard on server memory, while nginx (great at static files) needs the help of php-fpm or similar modules for dynamic content.

However, one can combine the two web servers to great effect, with nginx as static web server front and apache processing the back end.

---------------------------------------------------------------------------------------------------------------------------------
1'st Install Nginx & apache
---------------------------------------------------------------------------------------------------------------------------------
How to install Nginx
How to install Apache

---------------------------------------------------------------------------------------------------------------------------------
2'nd Configure Nginx & Apache Conf
---------------------------------------------------------------------------------------------------------------------------------
== Nginx ==
# vi /etc/nginx/nginx.conf
-------------------------------------------------------------------------------------------------
include /etc/nginx/sites-enabled/*;
-------------------------------------------------------------------------------------------------

== Apache ==
# vi /etc/httpd.conf
-------------------------------------------------------------------------------------------------
# Include generic snippets of statements
Include conf.d/*

# Include the virtual host configurations:
Include sites-enabled/*
-------------------------------------------------------------------------------------------------
note : in this case we using case magento installation 
---------------------------------------------------------------------------------------------------------------------------------
3'rd Configure nginx & Apache sites-enable ---------------------------------------------------------------------------------------------------------------------------------
 == Nginx ==
# touch /etc/nginx/sites-enable/magento

# vi /etc/nginx/sites-enable/magento
-------------------------------------------------------------------------------------------------
 server {
        listen   80;

        root /var/www/magento;
        index index.php index.html index.htm;

        server_name latihan.masih-bodoh.com;

        location / {
        try_files $uri $uri/ /index.php;
        }
    root /var/www/magento;
        location ~ \.php$ {
        index  index.html index.htm;
        proxy_set_header X-Real-IP  $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:9000;
      

         }

    location /phpmyadmin {
        root   /usr/share/phpmyadmin;
        index  index.html index.htm;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass https://localhost/phpmyadmin;
    }


         location ~ /\.ht {
                deny all;
        }
}
-------------------------------------------------------------------------------------------------
# ln -s /etc/nginx/sites-available/magento /etc/nginx/sites-enabled/magento
# rm /etc/nginx/sites-enabled/default
== Apache ==
 
Change port apache to 81, for avoid same ports with nginx
# vi /etc/httpd.conf
-------------------------------------------------------------------------------------------------
NameVirtualHost 127.0.0.1:81
Listen 127.0.0.1:81
-------------------------------------------------------------------------------------------------
# vi /etc/apache2/sites-available/magento
-------------------------------------------------------------------------------------------------
<VirtualHost *:8081>
    ServerAdmin wahyubudiprastowo@gmail.com
    DocumentRoot /var/www/magento/
   
    <Directory /var/www/magento/>
        Options FollowSymLinks
        AllowOverride all
    </Directory>
        ErrorLog /var/log/apache2/magento_error.log
        CustomLog /var/log/apache2/magento_access.log combined
        LogLevel warn
</VirtualHost>
 -------------------------------------------------------------------------------------------------
#  cp /etc/apache2/sites-available/magento /etc/apache2/sites-enable/magento
Note : Setting Ssl If you need to configure magento with https
# vi /etc/apache2/conf.d/magento-ssl
-------------------------------------------------------------------------------------------------
 NameVirtualHost *:443

<VirtualHost *:443>

    ServerName latihan.masih-bodoh.com
    ServerAdmin wahyubudiprastowo@gmail.com
    DocumentRoot /var/www/magento/

    SSLEngine on
    SSLCertificateKeyFile /etc/apache2/ssl/server.cert.key
    SSLCertificateFile /etc/apache2/ssl/server.cert.crt
    SSLProtocol all
    SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL

    <Directory /var/www/magento/>
        AllowOverride All
        SSLRequire %{SSL_CIPHER_USEKEYSIZE} >= 128
    </Directory>

    ErrorLog /var/log/apache2/magento_error.log
    CustomLog /var/log/apache2/magento_access.log combined
    LogLevel warn

</VirtualHost>
 -------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------
4'rd Starting nginx & apache service
---------------------------------------------------------------------------------------------------------------------------------
# service nginx start
# service httpd start
---------------------------------------------------------------------------------------------------------------------------------
5'rd Test with info.php
---------------------------------------------------------------------------------------------------------------------------------
# vi /var/www/info.php
------------------------------------------------------------------------
<?
phpinfo( );
?>
------------------------------------------------------------------------

COMMENTS

Name

Android,5,Apache,3,Bash Scripting,5,Bot,1,Centos,12,Cisco,5,GNS3,1,Hacking,5,internet marketing,1,Mikrotik,4,Monitoring,2,Nginx,2,Paket Tracer,2,Squid Proxy,2,Tips And Tricks,1,Virtualization,1,Webmin,2,Webserver,4,
ltr
item
Berbagi Itu Indah: Configure Nginx ( FrontEnd ) and Apache ( Backend )
Configure Nginx ( FrontEnd ) and Apache ( Backend )
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifK_Q6WhbBd01dDgqO4QaZ0HliXJyDvGjghhKynjaAvyhGWAtAR8wIFJGv8EsHhRiq7YWWdckeiDBLD1pbSz_Ujs72FK2z6-_qujokv6ARDoXAAZvO0qKu6jOcf99CvalBxgTbQC9rXh5k/s320/nginx_vs_apache.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEifK_Q6WhbBd01dDgqO4QaZ0HliXJyDvGjghhKynjaAvyhGWAtAR8wIFJGv8EsHhRiq7YWWdckeiDBLD1pbSz_Ujs72FK2z6-_qujokv6ARDoXAAZvO0qKu6jOcf99CvalBxgTbQC9rXh5k/s72-c/nginx_vs_apache.png
Berbagi Itu Indah
https://wahyubud.blogspot.com/2013/05/configure-nginx-frontend-and-apache.html
https://wahyubud.blogspot.com/
https://wahyubud.blogspot.com/
https://wahyubud.blogspot.com/2013/05/configure-nginx-frontend-and-apache.html
true
4332986676755765585
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy