mirror of
https://github.com/codeguy/php-the-right-way.git
synced 2025-08-11 08:13:58 +02:00
Adding section on Servers and Deployment
Subsections are currently stubbed out. Need to add tutorials on setting up nginx and php-fpm as well as some general best practices for deployment (especially on shared hosts).
This commit is contained in:
29
_includes/servers-and-deployment.md
Normal file
29
_includes/servers-and-deployment.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Servers and Deployment
|
||||
|
||||
PHP applications can be deployed and run on production web servers in a number of ways.
|
||||
|
||||
## Platform as a Service (PaaS)
|
||||
|
||||
In recent years cloud platforms have become popular ways of deploying, hosting, and scaling PHP applications. These can be a great if you're learning PHP and don't have experience or interest in server admin work, too. You can find a list of [PHP PaaS "Platform as a Service" providers](#php_paas_providers) in our [resources section](#resources).
|
||||
|
||||
## Virtual or Dedicated Servers
|
||||
|
||||
If you are comfortable with systems administration, or are interested in learning it, virtual or dedicated servers give you complete control of your application's production environment.
|
||||
|
||||
### nginx and PHP-FPM
|
||||
|
||||
PHP, via PHP's built-in FastCGI Process Manager (FPM), pairs really nicely with [nginx](http://nginx.org), which is a lightweight, high-performance web server. It uses less memory than Apache and can better handle more concurrent requests. This is especially important on virtual servers that don't have much memory to spare. If you are working to put a new PHP app on its own server in production today, choose nginx and PHP-FPM.
|
||||
|
||||
* [Read more on nginx](http://nginx.org)
|
||||
* [Read more on PHP-FPM](http://php.net/manual/en/install.fpm.php)
|
||||
* [Read more on setting up nginx and PHP-FPM securely](https://nealpoole.com/blog/2011/04/setting-up-php-fastcgi-and-nginx-dont-trust-the-tutorials-check-your-configuration/)
|
||||
|
||||
### Apache and PHP
|
||||
|
||||
PHP and Apache have a long history together. Apache is wildly configurable and allows sites to control their configurations dynamically, via `.htaccess` files, on a per-directory basis. This has made it a popular choice for shared servers and an easy setup for PHP frameworks and open source apps like WordPress. Unfortunately, Apache uses more resources than nginx and cannot handle as many visitors at the same time. If you are on your own virtual/dedicated server and do not need the configurability of Apache, choose nginx and PHP-FPM.
|
||||
|
||||
## Shared Servers
|
||||
|
||||
PHP has shared servers to thank for its popularity. It is hard to find a host without PHP installed, but be sure it's the latest version. Shared servers allow you and other developers to deploy websites to a single machine. The upside to this is that it has become a cheap commodity. The downside is that you never know what kind of a ruckus your neighboring tenants are going to create; loading down the server or opening up security holes are the main concerns. If your project's budget can afford to avoid shared servers you should.
|
||||
|
||||
[Back to Top](#top){.top}
|
@@ -62,6 +62,13 @@
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#testing">Testing</a></li>
|
||||
<li><a href="#servers_and_deployment">Servers and Deployment</a>
|
||||
<ul>
|
||||
<li><a href="#platform_as_a_service_paas">Platform as a Service (PaaS)</a></li>
|
||||
<li><a href="#virtual_or_dedicated_servers">Virtual or Dedicated Servers</a></li>
|
||||
<li><a href="#shared_servers">Shared Servers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#libraries_and_frameworks">Libraries and Frameworks</a></li>
|
||||
<li><a href="#resources">Resources</a></li>
|
||||
</ul>
|
||||
|
@@ -26,6 +26,9 @@ layout: default
|
||||
{% capture testing_content %}{% include testing.md %}{% endcapture %}
|
||||
{{ testing_content|markdownify }}
|
||||
|
||||
{% capture servers_and_deployment_content %}{% include servers-and-deployment.md %}{% endcapture %}
|
||||
{{ servers_and_deployment_content|markdownify }}
|
||||
|
||||
{% capture frameworks_content %}{% include libraries-and-frameworks.md %}{% endcapture %}
|
||||
{{ frameworks_content|markdownify }}
|
||||
|
||||
|
Reference in New Issue
Block a user