---
title: How to Use Vultr’s LAMP Marketplace Application
url: https://docs.vultr.com/how-to-use-vultr-s-lamp-marketplace-application
description: Learn how to deploy, configure, and manage Vultr's LAMP Marketplace Application for your web hosting needs with this comprehensive step-by-step guide.
publish_date: 2025-04-17T15:17:46.831211Z
last_updated: 2026-04-15T00:00:00.077250Z
author: Mary Ogunmola
header_image: https://docs.vultr.com/public/doc-assets/2151/66cdb4ee-bb22-4ab7-aae3-1c91fadd439b.png
---

> Index of every Vultr Docs page in markdown: https://docs.vultr.com/llms.txt

The LAMP stack combines Linux, Apache, MySQL, and PHP to serve dynamic websites and applications. It provides a reliable foundation for hosting PHP-based applications with Apache's flexible web server, MySQL's robust database management, and PHP's server-side scripting capabilities. The Vultr Marketplace provides a pre-configured LAMP instance, enabling quick deployment and setup on a Vultr server.

This guide explains deploying and using [Vultr's LAMP Marketplace Application](https://www.vultr.com/marketplace/apps/lamp/). You will deploy an instance, verify the installation, configure DNS and SSL, set up a virtual host, secure MySQL, and implement best practices for production deployments.

## Deploy Vultr's LAMP Marketplace Application

1. Log in to your [Vultr Console](https://console.vultr.com/) and click the **Deploy Server** button.

1. Select your preferred server type.

1. Choose a server location.

1. Select a server plan with at least **1GB RAM** and **1 CPU core** for basic workloads, or **2GB RAM** and **2 CPU cores** for production applications.

1. Click the **Configure** button to proceed.

1. Under **Marketplace Apps**, search for `LAMP` and select it as the Marketplace Application.

1. Select the **Limited Login** option from the **Additional Features** section to create a limited user with sudo access.

1. Review your configurations and click the **Deploy Now** button to start deployment.

    > [!NOTE]
    > It may take up to 10 minutes for your server to finish installing the LAMP stack.

1. After the instance shows the status of Running, navigate to the **Server Overview** page and copy the SSH connection details.

## Initial Setup and Configuration

After deployment, verify the installation, configure DNS, and secure your LAMP stack before hosting applications.

1. Create a [DNS A record](https://docs.vultr.com/products/network/dns/provisioning) pointing to your server's IP address, such as `lamp.example.com`.

1. Connect to your Vultr server instance over [SSH](https://docs.vultr.com/how-to-use-ssh-with-vultr-servers) using the connection details from the Server Overview page.

### Verify LAMP Installation

1. Check the Apache service status.

    ```console
    $ sudo systemctl status apache2
    ```

    The service should show as `active (running)`.

1. Verify the PHP installation.

    ```console
    $ php -v
    ```

    Output:

    ```
    PHP 8.3.12 (cli) (built: Sep 27 2024 03:53:05) (NTS)
    ```

1. Check the MySQL service status.

    ```console
    $ sudo systemctl status mysql
    ```

    The service should show as `active (running)`.

1. Verify Apache is serving the default page by visiting `http://SERVER_IP` in a web browser.

### Configure Firewall Security

Secure your server by configuring the firewall to allow only necessary traffic before enabling SSL.

1. Allow SSH connections.

    ```console
    $ sudo ufw allow OpenSSH
    ```

1. Allow HTTP and HTTPS traffic for Apache and Certbot.

    ```console
    $ sudo ufw allow 'Apache Full'
    ```

1. Enable the firewall.

    ```console
    $ sudo ufw enable
    ```

1. Verify firewall status.

    ```console
    $ sudo ufw status
    ```

### Secure LAMP with SSL/TLS

Protect your web server with HTTPS using Let's Encrypt certificates via Certbot.

1. Install Certbot and the Apache plugin.

    ```console
    $ sudo apt update
    $ sudo apt install certbot python3-certbot-apache -y
    ```

1. Request an SSL certificate for your domain.

    ```console
    $ sudo certbot --apache -d lamp.example.com
    ```

    Follow the prompts and select the option to redirect HTTP traffic to HTTPS when asked.

1. Verify SSL certificate auto-renewal.

    ```console
    $ sudo certbot renew --dry-run
    ```

1. Access your site securely at `https://lamp.example.com`.

## Configure Apache Virtual Host

Set up a virtual host to serve your website with proper configurations for PHP applications.

1. Create a directory for your website.

    ```console
    $ sudo mkdir -p /var/www/lamp.example.com/html
    ```

1. Set proper ownership.

    ```console
    $ sudo chown -R www-data:www-data /var/www/lamp.example.com
    ```

1. Set safe directory permissions.

    ```console
    $ sudo chmod -R 755 /var/www/lamp.example.com
    ```

1. Create a test index file.

    ```console
    $ sudo nano /var/www/lamp.example.com/html/index.php
    ```

    ```php
    <!DOCTYPE html>
    <html>
    <head>
        <title>Welcome to LAMP Server</title>
    </head>
    <body>
        <h1>Success! The LAMP virtual host is working.</h1>
        <p>Server time: <?php echo date('Y-m-d H:i:s'); ?></p>
    </body>
    </html>
    ```

    Save and close the file.

1. Create an Apache virtual host configuration.

    ```console
    $ sudo nano /etc/apache2/sites-available/lamp.example.com.conf
    ```

    ```apache
    <VirtualHost *:80>
        ServerName lamp.example.com
        ServerAdmin admin@lamp.example.com
        DocumentRoot /var/www/lamp.example.com/html

        <Directory /var/www/lamp.example.com/html>
            Options -Indexes +FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/lamp.example.com-error.log
        CustomLog ${APACHE_LOG_DIR}/lamp.example.com-access.log combined
    </VirtualHost>
    ```

    Replace `lamp.example.com` with your domain name. 
    
    Save and close the file.

1. Enable the virtual host.

    ```console
    $ sudo a2ensite lamp.example.com.conf
    ```

1. Disable the default Apache site.

    ```console
    $ sudo a2dissite 000-default.conf
    ```

1. Enable required Apache modules.

    ```console
    $ sudo a2enmod rewrite ssl
    ```

1. Test the Apache configuration.

    ```console
    $ sudo apache2ctl configtest
    ```

    Output:

    ```
    Syntax OK
    ```

1. Reload Apache to apply changes.

    ```console
    $ sudo systemctl reload apache2
    ```

1. Run Certbot again to configure SSL for the new virtual host.

    ```console
    $ sudo certbot --apache -d lamp.example.com
    ```

1. Access your site at `https://lamp.example.com` to verify the test page loads with SSL.

## Configure MySQL Database

Set up MySQL with secure authentication and create a database for your application.

### Secure MySQL Installation

1. Run the MySQL secure installation script.

    ```console
    $ sudo mysql_secure_installation
    ```

    Follow the prompts:

    * **Set root password**: Enter a strong password
    * **Remove anonymous users**: Yes
    * **Disallow root login remotely**: Yes
    * **Remove test database**: Yes
    * **Reload privilege tables**: Yes

### Create Database and User

1. Log in to MySQL as root.

    ```console
    $ sudo mysql -u root -p
    ```

    Enter the root password when prompted.

1. Create a database for your application.

    ```sql
    > CREATE DATABASE myapp_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    ```

1. Create a dedicated database user.

    ```sql
    > CREATE USER 'myapp_user'@'localhost' IDENTIFIED BY 'secure_password_here';
    ```

    Replace `secure_password_here` with a strong password.

1. Grant privileges to the user.

    ```sql
    > GRANT ALL PRIVILEGES ON myapp_db.* TO 'myapp_user'@'localhost';
    ```

1. Flush privileges and exit.

    ```sql
    > FLUSH PRIVILEGES;
    > EXIT;
    ```

1. Test the new user connection.

    ```console
    $ mysql -u myapp_user -p myapp_db
    ```

    Enter the password when prompted. If you can access the database, the setup is correct.

## Configure PHP

Optimize PHP settings for production use and security.

### Update PHP Configuration

1. Edit the PHP configuration file for Apache.

    ```console
    $ sudo nano /etc/php/8.3/apache2/php.ini
    ```

1. Update the following settings for production use.

    ```ini
    upload_max_filesize = 64M
    post_max_size = 64M
    memory_limit = 256M
    max_execution_time = 300
    max_input_time = 300
    display_errors = Off
    log_errors = On
    error_log = /var/log/php/error.log
    ```

    Adjust values based on your application requirements. 
    
    Save and close the file.

1. Create the PHP log directory.

    ```console
    $ sudo mkdir -p /var/log/php
    $ sudo chown www-data:www-data /var/log/php
    ```

1. Restart Apache to apply changes.

    ```console
    $ sudo systemctl restart apache2
    ```

### Install Common PHP Extensions

1. Install frequently used PHP extensions.

    ```console
    $ sudo apt install php8.3-mysql php8.3-curl php8.3-gd php8.3-mbstring php8.3-xml php8.3-zip php8.3-intl -y
    ```

1. Restart Apache after installing extensions.

    ```console
    $ sudo systemctl restart apache2
    ```

1. Verify installed extensions.

    ```console
    $ php -m
    ```

## Best Practices and Configuration

Implement these recommendations to ensure your LAMP stack runs securely and efficiently.

### Security Hardening

1. Configure Apache security headers in your virtual host.

    ```console
    $ sudo nano /etc/apache2/sites-available/lamp.example.com.conf
    ```

    Add the following inside the `<VirtualHost>` block:

    ```apache
    Header always set X-Frame-Options "SAMEORIGIN"
    Header always set X-Content-Type-Options "nosniff"
    Header always set X-XSS-Protection "1; mode=block"
    Header always set Referrer-Policy "no-referrer-when-downgrade"
    ```

    Enable the headers module and reload Apache:

    ```console
    $ sudo a2enmod headers
    $ sudo systemctl reload apache2
    ```

1. Disable PHP version exposure.

    ```console
    $ sudo nano /etc/php/8.3/apache2/php.ini
    ```

    Set:

    ```ini
    expose_php = Off
    ```

    Restart Apache: `sudo systemctl restart apache2`

1. Hide Apache version information.

    ```console
    $ sudo nano /etc/apache2/conf-available/security.conf
    ```

    ```apache
    ServerTokens Prod
    ServerSignature Off
    ```

    Reload Apache: `sudo systemctl reload apache2`

1. Keep the system and packages updated.

    ```console
    $ sudo apt update
    $ sudo apt upgrade -y
    ```

### Performance Optimization

1. Enable PHP OPcache for better performance.

    ```console
    $ sudo nano /etc/php/8.3/apache2/php.ini
    ```

    ```ini
    opcache.enable=1
    opcache.memory_consumption=128
    opcache.interned_strings_buffer=8
    opcache.max_accelerated_files=10000
    opcache.revalidate_freq=60
    ```

    Restart Apache.

1. Enable Apache compression module.

    ```console
    $ sudo a2enmod deflate
    $ sudo systemctl reload apache2
    ```

1. Enable Apache caching module for static assets.

    ```console
    $ sudo a2enmod expires
    $ sudo systemctl reload apache2
    ```

### Backup Configuration

1. Create regular backups of important directories.

    ```console
    $ sudo tar -czf /root/backup-$(date +%F).tar.gz /var/www /etc/apache2 /etc/php
    ```

1. Back up MySQL databases.

    ```console
    $ sudo mysqldump -u root -p --all-databases > /root/mysql-backup-$(date +%F).sql
    ```

## Troubleshooting

This section covers common issues and diagnostic commands to help resolve problems with your LAMP stack.

### Check Service Status

1. Verify all services are running.

    ```console
    $ sudo systemctl status apache2
    $ sudo systemctl status mysql
    ```

1. View service logs.

    ```console
    $ sudo journalctl -u apache2 -e
    $ sudo journalctl -u mysql -e
    $ sudo tail -f /var/log/apache2/error.log
    ```

### Common Issues

#### 500 Internal Server Error

1. Check Apache error logs for details.

    ```console
    $ sudo tail -50 /var/log/apache2/error.log
    $ sudo tail -50 /var/log/apache2/lamp.example.com-error.log
    ```

1. Verify PHP is properly configured.

    ```console
    $ php -v
    $ sudo systemctl status apache2
    ```

1. Test Apache configuration.

    ```console
    $ sudo apache2ctl configtest
    ```

#### PHP Files Downloading Instead of Executing

1. Verify PHP module is enabled.

    ```console
    $ sudo a2enmod php8.3
    $ sudo systemctl restart apache2
    ```

1. Check that `.php` files are configured correctly in Apache.

    ```console
    $ apachectl -M | grep php
    ```

#### Permission Denied Errors

1. Set proper ownership for web directories.

    ```console
    $ sudo chown -R www-data:www-data /var/www/lamp.example.com
    $ sudo chmod -R 755 /var/www/lamp.example.com
    ```

1. Verify Apache is running as the correct user.

    ```console
    $ ps aux | grep apache2
    ```

1. Check SELinux or AppArmor restrictions if applicable.

#### MySQL Connection Errors

1. Verify MySQL is running and accessible.

    ```console
    $ sudo systemctl status mysql
    $ mysql -u root -p -e "SELECT 1;"
    ```

1. Check user privileges.

    ```console
    $ sudo mysql -u root -p -e "SELECT user, host FROM mysql.user;"
    ```

1. Verify MySQL socket permissions.

    ```console
    $ ls -l /var/run/mysqld/mysqld.sock
    ```

#### .htaccess Not Working

1. Ensure `mod_rewrite` is enabled.

    ```console
    $ sudo a2enmod rewrite
    $ sudo systemctl restart apache2
    ```

1. Verify `AllowOverride All` is set in the virtual host configuration.

## Use Cases

The LAMP stack provides a widely-supported environment suitable for various PHP-based web workloads:

* **Content Management Systems**: Deploy WordPress, Drupal, Joomla, or other CMS platforms with Apache's robust virtual host configuration.
* **E-commerce Platforms**: Run Magento, PrestaShop, WooCommerce, or OpenCart stores with secure SSL and reliable database management.
* **PHP Frameworks**: Host Laravel, Symfony, CodeIgniter, or custom PHP applications with Apache's flexible `.htaccess` support.
* **Legacy Applications**: Maintain compatibility with applications requiring Apache-specific features and modules.
* **Web Applications**: Deploy business applications, CRM systems, project management tools, or SaaS platforms.
* **Development Environments**: Create staging and testing environments that mirror production Apache configurations.

## Conclusion

In this guide, you deployed Vultr's LAMP Marketplace Application and configured it for production use. You secured the server with firewall rules and SSL/TLS certificates, set up Apache virtual hosts with proper permissions, configured MySQL with secure authentication and dedicated database users, and optimized PHP settings for performance and security. With this production-ready LAMP stack, you can host PHP applications, manage databases, and serve dynamic content reliably using Apache's proven web server technology.
