Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| computers:truenas:famp [25-Oct-2021 10:46] – [PHP Software] Steve Joynt | computers:truenas:famp [02-Feb-2025 16:14] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 16: | Line 16: | ||
| < | < | ||
| # Tailor each of these examples for your own situation | # Tailor each of these examples for your own situation | ||
| - | JAIL_NAME=" | + | DOMAIN_NAME=" |
| + | JAIL_NAME=" | ||
| RELEASE_NAME=" | RELEASE_NAME=" | ||
| - | DOMAIN_NAME=" | ||
| LAN_IP=" | LAN_IP=" | ||
| GATEWAY_IP=" | GATEWAY_IP=" | ||
| DNS_IP=" | DNS_IP=" | ||
| PHP_VER=" | PHP_VER=" | ||
| + | |||
| </ | </ | ||
| - | 3. Delete any old jail with the same name - e.g. if you're setting this same jail up again. Most people do not need to perform this step. Be careful you don't delete a jail that you still want to keep! | + | 3. Delete any old jail with the same name - e.g. if you're setting this same jail up again. Most people do not need to perform this step. **Be careful you don't delete a jail that you still want to keep!** |
| < | < | ||
| iocage destroy --force " | iocage destroy --force " | ||
| + | |||
| </ | </ | ||
| Line 44: | Line 46: | ||
| defaultrouter6=none \ | defaultrouter6=none \ | ||
| resolver=" | resolver=" | ||
| + | |||
| </ | </ | ||
| Line 50: | Line 53: | ||
| jexec " | jexec " | ||
| "echo \" | "echo \" | ||
| + | |||
| </ | </ | ||
| 6. Prepare the package manager. | 6. Prepare the package manager. | ||
| < | < | ||
| - | jexec " | + | jexec " |
| pkg update | pkg update | ||
| + | |||
| </ | </ | ||
| Line 65: | Line 70: | ||
| -j " | -j " | ||
| -install apache24 | -install apache24 | ||
| + | |||
| </ | </ | ||
| Line 71: | Line 77: | ||
| jexec " | jexec " | ||
| "echo \" | "echo \" | ||
| + | |||
| </ | </ | ||
| 3. Enable the web server so it starts when the jail boots up. | 3. Enable the web server so it starts when the jail boots up. | ||
| < | < | ||
| - | jexec " | + | jexec " |
| sysrc apache24_enable=YES | sysrc apache24_enable=YES | ||
| + | |||
| </ | </ | ||
| 4. Start the web server now. | 4. Start the web server now. | ||
| < | < | ||
| - | jexec " | + | jexec " |
| service apache24 start | service apache24 start | ||
| + | |||
| </ | </ | ||
| Line 92: | Line 101: | ||
| -j " | -j " | ||
| install mysql80-client mysql80-server | install mysql80-client mysql80-server | ||
| + | |||
| </ | </ | ||
| 2. Enable the database server so it starts when the jail boots up. | 2. Enable the database server so it starts when the jail boots up. | ||
| < | < | ||
| - | jexec " | + | jexec " |
| sysrc mysql_enable=YES | sysrc mysql_enable=YES | ||
| + | |||
| </ | </ | ||
| 3. Start the database server now. | 3. Start the database server now. | ||
| < | < | ||
| - | jexec " | + | jexec " |
| service mysql-server start | service mysql-server start | ||
| + | |||
| </ | </ | ||
| - | 4. Secure and configure | + | 4. Generate a random root password for the database server. |
| < | < | ||
| - | jexec " | + | echo " |
| + | |||
| + | </ | ||
| + | |||
| + | 5. Secure and configure the database server. | ||
| + | < | ||
| + | jexec " | ||
| mysql_secure_installation | mysql_secure_installation | ||
| + | |||
| </ | </ | ||
| * Would you like to setup VALIDATE PASSWORD component? **No** (Assuming you are the only user, and you trust yourself) | * Would you like to setup VALIDATE PASSWORD component? **No** (Assuming you are the only user, and you trust yourself) | ||
| + | * Please set the password for root here. (Use the random password generated at step 4). | ||
| * Remove anonymous users? **Yes** | * Remove anonymous users? **Yes** | ||
| * Disallow root login remotely? **Yes** | * Disallow root login remotely? **Yes** | ||
| * Remove test database and access to it? **Yes** | * Remove test database and access to it? **Yes** | ||
| * Reload privilege tables now? **Yes** | * Reload privilege tables now? **Yes** | ||
| + | |||
| + | 5. Remember the root password for the database. | ||
| + | < | ||
| + | jexec " | ||
| + | mysql_config_editor set --host=localhost --user=root --password | ||
| + | |||
| + | </ | ||
| + | Use the random password generated at step 4. | ||
| ====== PHP Software ====== | ====== PHP Software ====== | ||
| Line 145: | Line 173: | ||
| php${PHP_VER:? | php${PHP_VER:? | ||
| php${PHP_VER:? | php${PHP_VER:? | ||
| + | |||
| </ | </ | ||
| Line 151: | Line 180: | ||
| jexec " | jexec " | ||
| cp / | cp / | ||
| + | |||
| </ | </ | ||
| You may want to amend the configuration manually | You may want to amend the configuration manually | ||
| Line 156: | Line 186: | ||
| jexec " | jexec " | ||
| vi / | vi / | ||
| + | |||
| </ | </ | ||
| 3.Configure Apache to use PHP | 3.Configure Apache to use PHP | ||
| < | < | ||
| + | jexec " | ||
| + | "cat >| / | ||
| + | <<END | ||
| + | < | ||
| + | DirectoryIndex index.php index.html | ||
| + | < | ||
| + | SetHandler application/ | ||
| + | </ | ||
| + | < | ||
| + | SetHandler application/ | ||
| + | </ | ||
| + | </ | ||
| + | END | ||
| + | |||
| + | </ | ||
| + | |||
| + | 4. Ensure the Apache configuration is ok. | ||
| + | < | ||
| + | jexec " | ||
| + | apachectl configtest | ||
| + | |||
| + | </ | ||
| + | |||
| + | 5. Restart the Apache server with the new configuration. | ||
| + | < | ||
| + | jexec " | ||
| + | apachectl restart | ||
| + | |||
| + | </ | ||
| + | |||
| + | ====== Create a Database for your Web Site ====== | ||
| + | |||
| + | 1. Make some decisions and define some variables. | ||
| + | < | ||
| + | DB_NAME=" | ||
| + | DB_USER=" | ||
| + | DB_PASS=" | ||
| + | set | grep " | ||
| + | |||
| + | </ | ||
| + | Make a note of this information. You'll need to configure your web site with the same details. | ||
| + | |||
| + | 2. Create the user login. | ||
| + | < | ||
| + | echo " | ||
| + | | jexec " | ||
| + | |||
| + | </ | ||
| + | |||
| + | 3. Create the database. | ||
| + | < | ||
| + | echo " | ||
| + | | jexec " | ||
| + | |||
| + | </ | ||
| + | |||
| + | 4. Allow full access to the database for the user. | ||
| + | < | ||
| + | echo "GRANT ALL ON ${DB_NAME:? | ||
| + | | jexec " | ||
| + | |||
| + | </ | ||
| + | |||
| + | ====== Install your Web Site files ====== | ||
| + | |||
| + | Tip: To make it easier to find your Document Root folder in future, it's probably best to create a symbolic link. | ||
| + | < | ||
| + | jexec " | ||
| + | ln -s / | ||
| + | |||
| + | </ | ||
| + | |||
| + | You can find your Document Root folder here... | ||
| + | < | ||
| + | cd / | ||
| + | |||
| </ | </ | ||