Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung Nächste ÜberarbeitungBeide Seiten der Revision | ||
content:apache_phpfpm [2020/09/26 11:07] – [Filling Content to your Server] Daniel | content:apache_phpfpm [2022/03/02 18:39] – [Tell Apache to use php-fpm] Daniel | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | ====== | + | ====== |
===== Howto setup a LAMP-Server in 2018-2020 ===== | ===== Howto setup a LAMP-Server in 2018-2020 ===== | ||
- | This documentation is about how to set up a LAMP- Server (Linux, Apache, MySql, PhP) in the current, most stable way. The Reason | + | This documentation is about how to set up a LAMP- Server (Linux, Apache, MySql aka MariaDB, PhP) in the current, most stable way for home office usage. The reason |
+ | |||
+ | To get the Differences, | ||
+ | |||
+ | * Apache-Prefork. That way, Apache is one Application with many threads - which is slower, consumes more memory and doesn' | ||
+ | * PHP-Module integrated in the Apache- Server which is not released as stable and may crash the whole Apache- Server on Errors. This module must be released to match the Apache- version, so the versions are tied together | ||
+ | * PHP- Modules, which must be compiled againt the apache-mod_php- module. Updating mod_php means updating all modules. | ||
+ | * Using Network Connections with overhead to connect to | ||
+ | * MariaDB | ||
+ | |||
+ | And here is what this guide will set up: | ||
+ | |||
+ | * Apache- Event. That way, Apache is one small Apache- Manager- Application which will spawn as many Apache- Servers as needed to handle the incoming connections dynamically. This is stable, as one Error may only crash the one Instance, which will be respawned by the Apache- Manager dynamically | ||
+ | * Connection to php is done by Proxy- Handling in Apache | ||
+ | * PHP-FPM will also Spawn PHP-Instances dynamically for each script beeing run | ||
+ | * Using Socket Connections to connect to | ||
+ | * MariaDB | ||
==== Choosing Installation-Media & Install Basic System ==== | ==== Choosing Installation-Media & Install Basic System ==== | ||
- | First, starting from Windows, you should make shure to have enough harddisk- space free. Then get a installation-medium of the Linux your choice. I will stick to OpenSuSE as to get from [[https:// | + | First, starting from Windows, you should make sure to have enough harddisk- space free (i recommend at least 60 GB). Then get the installation-medium of the Linux your choice. I will stick to OpenSuSE as to get from [[https:// |
- | - Download the DVD-Image | + | - Download the DVD-Image |
- Make the Installation- Media | - Make the Installation- Media | ||
- Install the System with standard Desktop- Packages (KDE) | - Install the System with standard Desktop- Packages (KDE) | ||
Zeile 40: | Zeile 57: | ||
Use " | Use " | ||
- | ==== Install MySql ==== | + | ==== Install |
In OpenSuSE MariaDB is available and working out of the Box (maybe change the Admin- Password at first Start). MySQL is tuneable in / | In OpenSuSE MariaDB is available and working out of the Box (maybe change the Admin- Password at first Start). MySQL is tuneable in / | ||
Zeile 56: | Zeile 73: | ||
Memory-Usage will be: innodb_buffer_pool_size + ( join_buffer_size + sort_buffer_size + readn_rnd_buffer_size ) * max_connections. If your System has more memory, use some tuning script (like MySQLTuner-perl) to see what makes most sense to put the memory to. | Memory-Usage will be: innodb_buffer_pool_size + ( join_buffer_size + sort_buffer_size + readn_rnd_buffer_size ) * max_connections. If your System has more memory, use some tuning script (like MySQLTuner-perl) to see what makes most sense to put the memory to. | ||
- | For a local setup, you should use Sockets and disable networking. To do this, set <font inherit/ | + | For a local setup, you should use Sockets and disable networking. To do this, set |
+ | <code> | ||
+ | |||
+ | socket = / | ||
+ | |||
+ | </code> | ||
You should than deactivate TCP/IP with " | You should than deactivate TCP/IP with " | ||
Start Mysql with " | Start Mysql with " | ||
- | After that had worked you should secure your Database by giving a password as it was explained by the step above when starting it. If not shure just run "< | + | After that had worked you should secure your Database by giving a password as it was explained by the step above when starting it. If not shure just run " <font inherit/ |
==== Install Apache ==== | ==== Install Apache ==== | ||
Zeile 76: | Zeile 99: | ||
* Commit the Changes | * Commit the Changes | ||
* in / | * in / | ||
- | < | ||
+ | < | ||
#This Config is for event or worker MPMs. | #This Config is for event or worker MPMs. | ||
# | # | ||
Zeile 150: | Zeile 173: | ||
< | < | ||
- | listen = /var/ | + | listen = /run/php-fpm/ |
listen.owner = wwwrun | listen.owner = wwwrun | ||
listen.group = www | listen.group = www | ||
Zeile 199: | Zeile 222: | ||
* To enable this and all its dependencies, | * To enable this and all its dependencies, | ||
- | < | ||
- | sudo a2enmod setenvif rewrite proxy proxy_fcgi | + | < |
+ | sudo a2enmod setenvif | ||
+ | sudo a2enmod | ||
+ | sudo a2enmod | ||
+ | sudo a2enmod | ||
</ | </ | ||
Zeile 212: | Zeile 238: | ||
# Don't use " | # Don't use " | ||
# This is to forward all PHP to php-fpm | # This is to forward all PHP to php-fpm | ||
- | < | + | < |
- | | + | SetHandler " |
- | </ | + | </ |
+ | DirectoryIndex index.php | ||
# Don't use " | # Don't use " | ||
# <Proxy fcgi:// | # <Proxy fcgi:// | ||
- | <Proxy fcgi:// | + | <Proxy fcgi:// |
- | #6 Hours = 21600 | + | |
- | #Make this high, as upload will stop after that amount of time | + | |
- | ProxySet connectiontimeout=30 timeout=21600 | + | |
- | </ | + | </ |
- | # If the php file doesn' | + | # If the php file doesn' |
- | # This will allow .htaccess rewrite rules to work and | + | # This will allow .htaccess rewrite rules to work and |
- | # the client will see the default 404 page of Apache | + | # the client will see the default 404 page of Apache |
- | | + | RewriteCond %{REQUEST_FILENAME} \.php$ |
- | | + | RewriteCond %{DOCUMENT_ROOT}/ |
- | | + | RewriteRule (.*) - [H=text/ |
</ | </ | ||
+ | |||
==== Start and check Apache ==== | ==== Start and check Apache ==== | ||
Zeile 273: | Zeile 301: | ||
Well: You are done. Now its up to you to fill Apache with content. Have fun! | Well: You are done. Now its up to you to fill Apache with content. Have fun! | ||
- | |||
==== Manage Database with phpMyAdmin ==== | ==== Manage Database with phpMyAdmin ==== | ||
- | To manage your local Database, it would be nice to have phpMyAdmin installed first (via Package-manager). After that, copy the config.sample.inc.php to config.inc.php under / | + | To manage your local Database, it would be nice to have phpMyAdmin installed first (via Package-manager). After that, copy the config.sample.inc.php to config.inc.php under / |
You can finish the setup of your phpMyAdmin by visiting [[http:// | You can finish the setup of your phpMyAdmin by visiting [[http:// | ||
- | |||
===== Installing Eclipse ===== | ===== Installing Eclipse ===== | ||
Zeile 287: | Zeile 313: | ||
You may download the file, extract the contents (e.g. to ~/eclipse) and run the installer there in userspace (no superuser is required). | You may download the file, extract the contents (e.g. to ~/eclipse) and run the installer there in userspace (no superuser is required). | ||
- | |||
===== Filling Content to your Server ===== | ===== Filling Content to your Server ===== | ||
This is a demo to install some small Software to your Server. I will use the github- Project [[https:// | This is a demo to install some small Software to your Server. I will use the github- Project [[https:// | ||
- | |||
==== Install git-web ==== | ==== Install git-web ==== |