Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matteomorreale/secure-wp-installation-litespeed
This script allows you to create a custom User for your LiteSpeed server and automatically assign files and permissions, so that the WP installation is isolated from the others in a shared environment
https://github.com/matteomorreale/secure-wp-installation-litespeed
litespeed litespeed-web-server openlitespeed wordpress wordpress-site
Last synced: 28 days ago
JSON representation
This script allows you to create a custom User for your LiteSpeed server and automatically assign files and permissions, so that the WP installation is isolated from the others in a shared environment
- Host: GitHub
- URL: https://github.com/matteomorreale/secure-wp-installation-litespeed
- Owner: matteomorreale
- License: gpl-3.0
- Created: 2024-11-27T17:58:08.000Z (29 days ago)
- Default Branch: main
- Last Pushed: 2024-11-27T18:05:14.000Z (29 days ago)
- Last Synced: 2024-11-27T18:45:10.473Z (29 days ago)
- Topics: litespeed, litespeed-web-server, openlitespeed, wordpress, wordpress-site
- Language: Shell
- Homepage: https://matteomorreale.it
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# WordPress Permission Configuration Script for OpenLiteSpeed
This script automates the setup of permissions for WordPress installations on OpenLiteSpeed servers to ensure that one installation cannot access another one's.
---
## Prerequisites
- Ensure you have OpenLiteSpeed installed and running.
- Verify that you have root or sudo privileges to execute the commands.
- Replace all occurrences of **`yourusername`** with your actual username on the server.---
## Notes
- Replace **`yourusername`** in the script where necessary to match your server's setup.
- Verify that your Virtual Host is **not using a template** before applying the suEXEC settings, if so instantiate if first.---
## Features
- Automatically creates a system user and group for each WordPress site.
- Assigns proper permissions to `public`, `wp-content/cache`, and `wp-content/uploads` directories.
- Ensures compatibility with OpenLiteSpeed's **suEXEC User** and **suEXEC Group** settings for enhanced security.---
## Usage
1. **Download the Script**
Save the script to your server, e.g., `/usr/local/lsws/scripts/wp_permission_config.sh`.2. **Run the Script**
```bash
sudo bash wp_permission_config.sh
```
Replace `` with the name of the WordPress installation folder, e.g., `example-site`.3. **Update OpenLiteSpeed Virtual Host Settings**
- Log in to the OpenLiteSpeed Web Admin Panel.
- Navigate to the **Virtual Hosts** section.
- Select the Virtual Host where your WordPress site is hosted.
- Go to **Basic > Security**.
- In the **suEXEC User** and **suEXEC Group** fields, enter:
- The **username** created by the script.
- The **group name** created by the script.
- Save changes and restart the server.⚠️ **Important:**
- This method is **only applicable to single Virtual Hosts**.
- If you're using a Virtual Host Template, instantiate a single Virtual Host from the template before applying these changes.4. **Restore .htaccess (Optional)**
If necessary, replace the `.htaccess` file in the `public` directory with the default WordPress `.htaccess` content.---
## Example
### Script Execution
```bash
sudo chmod +x wp_permission_config.sh
sudo bash wp_permission_config.sh example-site
```- The script will create a user and group based on the folder name.
Example:
- User: `example-site`
- Group: `example-site-`### Virtual Host Configuration
- In the OpenLiteSpeed Admin Panel:
- **suEXEC User**: `example-site`
- **suEXEC Group**: `example-site-`---
## License
This script is provided under the MIT License. Use at your own risk. Contributions are welcome!