nndocs:lamp
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| nndocs:lamp [2015/07/19 18:09] – [PHP-APC] formatting naptastic | nndocs:lamp [2024/09/17 13:51] (current) – [First, create the Universe...] We're on Debian 12 now, lol naptastic | ||
|---|---|---|---|
| Line 3: | Line 3: | ||
| In this guide, I'm just gonna do everything as root unless otherwise specified. | In this guide, I'm just gonna do everything as root unless otherwise specified. | ||
| - | Install Debian | + | Install Debian, following the [[nndocs: |
| * De-select Graphical Desktop Environment and Laptop. | * De-select Graphical Desktop Environment and Laptop. | ||
| Line 25: | Line 25: | ||
| ==== Tune Apache ==== | ==== Tune Apache ==== | ||
| - | Find this section in / | + | Find this section in / |
| < | < | ||
| Line 40: | Line 40: | ||
| < | < | ||
| - | StartServers | + | StartServers |
| ServerLimit | ServerLimit | ||
| MaxClients | MaxClients | ||
| Line 52: | Line 52: | ||
| What we're doing here is tuning Apache to handle the largest possible number of simultaneous connections while consuming the least resources and producing the fewest errors. | What we're doing here is tuning Apache to handle the largest possible number of simultaneous connections while consuming the least resources and producing the fewest errors. | ||
| - | '' | + | '' |
| + | |||
| + | # apache2ctl status | ||
| + | | ||
| + | |||
| + | | ||
| + | mod_perl/ | ||
| + | |||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | Total accesses: 8 - Total Traffic: 85 kB - Total Duration: 816 | ||
| + | CPU Usage: u.07 s.03 cu0 cs0 - .0952% CPU load | ||
| + | .0762 requests/ | ||
| + | 1 requests currently being processed, 0 workers gracefully restarting, | ||
| + | 63 idle workers | ||
| + | |||
| + | Slot PID Stopping | ||
| + | total accepting busy graceful idle writing keep-alive closing | ||
| + | 1 1343 no | ||
| + | Sum 1 0 0 | ||
| + | |||
| + | ................................................................ | ||
| + | ______________W_________________________________________________ | ||
| + | ................................................................ | ||
| + | ................................................................ | ||
| + | ................................................................ | ||
| + | ................................................................ | ||
| + | ................................................................ | ||
| + | ................................................................ | ||
| + | ................................................................ | ||
| + | ................................................................ | ||
| + | ................................................................ | ||
| + | ................................................................ | ||
| + | ................................................................ | ||
| + | ................................................................ | ||
| + | ................................................................ | ||
| + | ................................................................ | ||
| + | |||
| + | | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| '' | '' | ||
| Line 60: | Line 110: | ||
| == Timeout == | == Timeout == | ||
| - | Then find the '' | + | Then find the '' |
| == KeepAlive == | == KeepAlive == | ||
| Line 70: | Line 120: | ||
| * '' | * '' | ||
| - | As part of this, you will create a MySQL root password. This doesn' | + | Since Debian Buster, I haven' |
| - | + | ||
| - | === Create /root/.my.cnf | + | |
| - | + | ||
| - | If you ever want to do anything from the command line you will either | + | |
| [client] | [client] | ||
| Line 80: | Line 126: | ||
| password=" | password=" | ||
| - | You can create a .my.cnf file in any user's home directory so they can do mysql stuff from the shell without having to constantly supply their MySQL username and password. | + | You can create a .my.cnf file in any user's home directory so they can do mysql stuff from the shell without having to constantly supply their MySQL username and password. |
| - | ==== PHP ==== | + | |
| - | You'll need these: | + | |
| - | + | * chmod 600 | |
| - | | + | |
| - | + | ||
| - | Download and build PHP to include everything we'll need: | + | |
| - | + | ||
| - | * '' | + | |
| - | * ''< | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | * ''< | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | + | ||
| - | Install '' | + | |
| - | + | ||
| - | * '' | + | |
| - | + | ||
| - | Install | + | |
| - | + | ||
| - | * '' | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | + | ||
| - | Install the FPM-specific configuration files. | + | |
| - | + | ||
| - | * '' | + | |
| - | + | ||
| - | Edit the file ''/ | + | |
| - | + | ||
| - | include=/ | + | |
| - | [global] | + | |
| - | pid = / | + | |
| - | error_log = / | + | |
| - | + | ||
| - | In ''/ | + | |
| - | + | ||
| - | I'm debating whether it makes more sense to create a separate pool per-virtualhost instead of per-user. Whatever. Here's what you put in each pool definition file: | + | |
| - | + | ||
| - | [david] | + | |
| - | user = david | + | |
| - | group = david | + | |
| - | + | ||
| - | listen = / | + | |
| - | listen.owner = www-data | + | |
| - | listen.group = www-data | + | |
| - | listen.mode = 0660 | + | |
| - | + | ||
| - | pm = dynamic | + | |
| - | pm.max_children = 24 | + | |
| - | pm.start_servers = 1 | + | |
| - | pm.min_spare_servers = 1 | + | |
| - | pm.max_spare_servers = 2 | + | |
| - | pm.max_requests = 32768 | + | |
| - | ; | + | |
| - | + | ||
| - | Of course, change ' | + | |
| - | + | ||
| - | "But David," | + | |
| - | + | ||
| - | ==== PHP-APC === | + | |
| - | + | ||
| - | | + | |
| - | | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | * ''< | + | |
| - | * '' | + | |
| - | * '' | + | |
| - | + | ||
| - | Add this to the end of ''/ | + | |
| - | + | ||
| - | extension=' | + | |
| - | apc.enable=1 | + | |
| - | apc.shm_size=256m | + | |
| - | + | ||
| - | At this point, PHP-FPM is ready to start if you want. | + | |
| - | + | ||
| - | * '' | + | |
| - | + | ||
| - | ==== LAMP stack done. ==== | + | |
| - | + | ||
| - | Time to create some sites. By Debian convention, virtualhost definition files go in / | + | |
| - | + | ||
| - | Here's the format for virtualhost files: | + | |
| - | + | ||
| - | < | + | |
| - | ServerName blog.naptastic.com | + | |
| - | ServerAdmin naptastic@gmail.com | + | |
| - | + | ||
| - | DocumentRoot / | + | |
| - | < | + | |
| - | Options -FollowSymLinks -Indexes -MultiViews | + | |
| - | AllowOverride all | + | |
| - | </ | + | |
| - | < | + | |
| - | DirectoryIndex index.php | + | |
| - | Options -Indexes -FollowSymLinks -MultiViews | + | |
| - | AllowOverride all | + | |
| - | </ | + | |
| - | + | ||
| - | ErrorLog ${APACHE_LOG_DIR}/ | + | |
| - | LogLevel warn | + | |
| - | CustomLog ${APACHE_LOG_DIR}/ | + | |
| - | + | ||
| - | < | + | |
| - | AddType application/ | + | |
| - | Action application/ | + | |
| - | Alias /php.fcgi / | + | |
| - | </ | + | |
| - | + | ||
| - | ProxyPassMatch ^/ | + | |
| - | + | ||
| - | </ | + | |
| - | FIXME - This is specific to one site. Needs to be generalized. | ||
nndocs/lamp.1437329346.txt.gz · Last modified: 2015/07/19 18:09 by naptastic
