Follow these steps to install MoDirectory on your server and set up the necessary dependencies.
MoDirectory is a powerful, self-hosted business directory software platform designed for creating and managing local business listings across any niche.
This guide will walk you through the initial setup, server requirements, and installation of the project on your web server.
Ensure your server meets the following requirements before proceeding:
mod_rewrite
After purchasing MoDirectory, download the ZIP file from the Downloads page and upload it to your web server. You can use file transfer client like FileZilla or WinSCP to upload the MoDirectory.zip to your web server. You need to move this folder to the document root directory of your domain, then unzip the MoDirectory.zip file.
cd /var/www/html
unzip MoDirectory.zip -d MoDirectory
Note: You can rename the MoDirectory
folder to match your domain name or a name of your choice for better branding.
Navigate to your MoDirectory
app folder and install dependencies.
cd MoDirectory
composer install
Enable Google OAuth and Maps API from the Google Developer Console.
After creating the credentials, update config.php
with your keys:
define('GOOGLE_CLIENT_ID', 'your_google_client_id');
define('GOOGLE_CLIENT_SECRET', 'your_google_client_secret');
define('GOOGLE_MAPS_API_KEY', 'your_google_maps_api_key');
define('GOOGLE_MAPS_SECRET_KEY', 'your_google_maps_secret_key');
For production, configure your web server to handle requests appropriately.
server {
listen 80;
server_name yourdomain.com;
server_tokens off;
access_log /var/log/nginx/yourdomain.com-access.log;
error_log /var/log/nginx/yourdomain.com-error.log;
location / {
proxy_pass http://localhost:5500;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Connection "";
keepalive_timeout 75s;
}
location /public/uploads/ {
alias /var/www/html/MoDirectory/public/uploads/;
access_log off;
location ~* \.(jpg|jpeg|png|gif|ico|webp)$ {
expires 30d;
add_header Cache-Control "public, no-transform";
}
location ~* \.(css|js|svg|woff|woff2)$ {
expires 7d;
add_header Cache-Control "public, no-transform";
}
}
location = /robots.txt {
alias /var/www/html/MoDirectory/public/robots.txt;
access_log off;
log_not_found off;
}
location = /sitemap.xml {
alias /var/www/html/MoDirectory/public/sitemap.xml;
access_log off;
log_not_found off;
}
location = /ads.txt {
alias /var/www/html/MoDirectory/public/ads.txt;
access_log off;
log_not_found off;
}
location = /favicon.ico {
access_log off;
log_not_found off;
}
error_page 404 /index.php;
}
To have Apache serve your app at http://localhost:5500
, ensure Apache is listening on port 5500 by adding Listen 5500
in your ports.conf
(or equivalent), then add a VirtualHost:
<VirtualHost *:5500>
ServerName yourdomain.com
DocumentRoot /var/www/html/MoDirectory
AllowOverride All
Require all granted
# Alias for static files
Alias /public/uploads/ /var/www/html/MoDirectory/public/uploads/
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
Alias /robots.txt /var/www/html/MoDirectory/public/robots.txt
Alias /sitemap.xml /var/www/html/MoDirectory/public/sitemap.xml
Alias /ads.txt /var/www/html/MoDirectory/public/ads.txt
ErrorLog ${APACHE_LOG_DIR}/yourdomain.com_error.log
CustomLog ${APACHE_LOG_DIR}/yourdomain.com_access.log combined
</VirtualHost>
Run the following commands to restart your PHP and web server:
sudo systemctl restart php-fpm
sudo systemctl restart nginx
Start the PHP built-in server by running the following command in the project root:
cd MoDirectory
nohup php -S localhost:5500 -t public > appserver_$(date +\%F).log 2>&1 &
Once the server is running, open your browser and navigate to:
https://yourdomain.com
This will load the live site served via the configured proxy.
Go to https://yourdomain.com/install and provide the following details to begin the installation process.
Click Install to complete the setup and installation process.
Login to your site using the credentials created during installation.
Go to https://yourdomain.com/license and enter your license key found in Downloads to activate the product.