LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 12-29-2017, 06:18 AM   #1
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Rep: Reputation: Disabled
Splitting web server for web application and mobile app


Hi All,
I am going to build a centos based apache server. Currently both web app (php application) and mobile app accessed the same web server to get data from the backend db. I was thinking to split to better cater for future traffic growth or should I stick to just one web server ?
 
Old 12-29-2017, 06:49 AM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,706
Blog Entries: 4

Rep: Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949Reputation: 3949
It is often a reasonable strategy to use the same server process, because the type-of-traffic in each case is consistent with what a web-server is designed to do. If you need scalability, consider a container-based strategy that can then be scaled-up or scaled-down (dynamically!) at any number of cloud-hosting services, such as RackSpace. Many of these services can actually scale-up/down for you automatically and dynamically, within ranges that you have set (and paid for): if traffic increases, so do the number of containers, and vice-versa.

"Container" technology is used because it is light-weight, providing the isolation that is required by a public-facing application in a shared environment – even up to the appearance of being "a virtual machine," if you select that kind of container – but without the overhead of actually running a VM. The hosting-service takes care of all the "iron" for you, and they use mainframes b-i-g iron. (They also get stuck futzing with their networks! "Yay!")

The database-interface and back-end interfaces (in general) that are used by a container-hosting service are a little bit more complex so that they, too, can be scaled up or down quickly.

Now, I don't consider "a mobile-facing web site" to be "a mobile app," not at all. Neither do I think that "a web-site in drag" is a mobile-app, either. But even ordinary web-frameworks can detect that a browser calls itself "mobile" and serve a different so-called "skin" on the content of the site in order to better suit its small display. This simply happens per-request in the choice of "templates" that are routinely used to format the content.

Web platforms can also commonly deliver content directly as YAML, JSON, or even XML, performing both "web page" functions and "API-call" functions – although they're not designed to serve as full-on SOAP-servers.

Last edited by sundialsvcs; 12-29-2017 at 06:52 AM.
 
Old 12-29-2017, 11:21 AM   #3
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Original Poster
Rep: Reputation: Disabled
Dear Sundia,
The issue is that we are going to use dedicated machine not cloud hosting. My os will be centos 7 and using apache as the web server and php as the core language. Off course the db servers will be behind this web server machine. So in this case what is your best suggestion should I go with apache cluster with HA proxy to resolve the increase of traffic?
 
Old 12-29-2017, 04:05 PM   #4
YesItsMe
Member
 
Registered: Oct 2014
Posts: 916

Rep: Reputation: 313Reputation: 313Reputation: 313Reputation: 313
Out of curiosity: Why did you choose Apache?
 
Old 12-29-2017, 10:07 PM   #5
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Original Poster
Rep: Reputation: Disabled
Hi Yes,
I choose it cause its widely used on linux. What is your suggestion then?
 
Old 12-29-2017, 10:15 PM   #6
YesItsMe
Member
 
Registered: Oct 2014
Posts: 916

Rep: Reputation: 313Reputation: 313Reputation: 313Reputation: 313
nginx for better scaling.
 
Old 12-29-2017, 10:46 PM   #7
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Original Poster
Rep: Reputation: Disabled
Hi Yes,
So you suggesting to move to nginx is it? Will it be better I did read before they said its good for static website. Mine is more into php and db oriented so will it better?
 
Old 12-29-2017, 10:56 PM   #8
YesItsMe
Member
 
Registered: Oct 2014
Posts: 916

Rep: Reputation: 313Reputation: 313Reputation: 313Reputation: 313
The performance of PHP and its DB drivers (you do use PHP 7.x, don't you?) does not depend on the chosen web server.
 
Old 12-29-2017, 10:58 PM   #9
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Original Poster
Rep: Reputation: Disabled
Hi Yes,
Yes I am working on centos 7 using php7 and mysql 5.7. So what do you suggest to move to nginx ? I am worried cause most of the google articles for e.g. https://poweruphosting.com/blog/apache-vs-nginx/ this say that for dynamic content both nginx and apache works almost same. So I am worried moving and not getting better performance or becoming worse. What is you suggestion on how to make nginx work best for my environment?
 
Old 12-29-2017, 11:02 PM   #10
YesItsMe
Member
 
Registered: Oct 2014
Posts: 916

Rep: Reputation: 313Reputation: 313Reputation: 313Reputation: 313
There is next to no chance that nginx will be slower. You especially asked for future traffic growth and nginx is awesome for that.
If you don't feel safe enough for that, just stick with Apache - but I can, at least, recommend you to have tried nginx once.

The configuration is much more pleasant as well. (I sometimes have nightmares about "httpd.conf"...)
 
Old 12-29-2017, 11:05 PM   #11
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Original Poster
Rep: Reputation: Disabled
Hi Yes,
Is it possible to run both now mean I shut my apache time being and move to nginx first? I am actually very confuse cause a lot claim it to be not fast enough for dynamic website. Will you recommend some good link on how to configure, optimise and secure nginx better?
 
Old 12-29-2017, 11:08 PM   #12
YesItsMe
Member
 
Registered: Oct 2014
Posts: 916

Rep: Reputation: 313Reputation: 313Reputation: 313Reputation: 313
You can run both web servers at the same time as long as they don't listen on the same port (i.e. 80, by default). You can configure that.

Quote:
Will you recommend some good link on how to configure, optimise and secure nginx better?
Here you go:
https://github.com/denji/nginx-tuning
 
Old 12-29-2017, 11:13 PM   #13
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Original Poster
Rep: Reputation: Disabled
Hi Yes,
Good idea I think I will give a try but kind of worried cause been reading it too. Anyway thank you for the link do send me other links if you have to further harden and boost the nginx ?
 
Old 12-29-2017, 11:17 PM   #14
YesItsMe
Member
 
Registered: Oct 2014
Posts: 916

Rep: Reputation: 313Reputation: 313Reputation: 313Reputation: 313
No, nginx does not require modifying more than one file to work properly.
 
Old 12-29-2017, 11:26 PM   #15
newbie14
Member
 
Registered: Sep 2011
Posts: 646

Original Poster
Rep: Reputation: Disabled
Hi Yes,
Ok so far I have done this changes for the conf file.

listen 8080 default_server;
listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html;

So all my php files have to put in this location /usr/share/nginx/html right?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Anatine (Pristine Twitter App) – Mobile web version of Twitter App for Linux Desktop LXer Syndicated Linux News 0 08-11-2016 07:00 AM
Web Monitoring Mobile App abhilashbsstabilix Linux - Mobile 2 08-09-2015 10:55 AM
When Deploying web app directory tomcat application server got hanged ? findnerd2 Linux - Software 1 06-20-2015 04:07 PM
How is splitting only a database server from the web server more secure? anthony01 Linux - Security 3 10-31-2012 02:12 PM
VPN access to web application from mobile workstations asphodel587 Linux - Networking 2 06-11-2010 09:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 01:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration