Osclass is an open-source classifieds script that allows users to create online marketplaces, job boards, real estate listings, and more. To run Osclass efficiently, you need a stable hosting environment optimized for performance, security, and scalability.
To ensure smooth performance for Osclass, choose a hosting setup that meets these requirements:
| Component | Requirement |
|---|---|
| Web Server | Apache / Nginx / LiteSpeed |
| PHP Version | PHP 7.4+ (PHP 8+ is recommended for better performance) |
| Database | MySQL 5.7+ or MariaDB 10+ |
| PHP Extensions | cURL, GD, MBstring, XML, OpenSSL, MySQLi |
| Memory Limit | At least 128MB (256MB+ recommended) |
For high-traffic Osclass websites with thousands of listings, a properly configured VPS is essential.
| Component | Specification |
|---|---|
| CPU | 3-4 vCPUs or more |
| RAM | 4GB RAM (8GB+ recommended for high traffic) |
| Storage | NVMe SSD with at least 40GB |
| Operating System | Ubuntu 22.04 LTS / AlmaLinux 9 |
| Web Server Stack | Nginx + PHP-FPM or Apache + mod_php |
| Database | MariaDB 10.6+ with optimized queries |
For Ubuntu/Debian:
sudo apt update && sudo apt upgrade -y
For CentOS/RHEL/AlmaLinux:
sudo yum update -y
Option A: Install Apache + MySQL + PHP (LAMP) - Ubuntu/Debian
sudo apt install apache2 mysql-server php php-mysqli php-curl php-gd php-mbstring php-xml php-zip unzip -y
Restart services:
sudo systemctl restart apache2
sudo systemctl restart mysql
Option B: Install Nginx + MySQL + PHP (LEMP) - Ubuntu/Debian
sudo apt install nginx mysql-server php-fpm php-mysqli php-curl php-gd php-mbstring php-xml php-zip unzip -y
Restart services:
sudo systemctl restart nginx
sudo systemctl restart mysql
Navigate to the web root and download Osclass:
cd /var/www/html
sudo wget https://osclass-community.github.io/osclass/download/osclass.zip
sudo unzip osclass.zip
sudo mv osclass/* .
Set the correct permissions:
sudo chown -R www-data:www-data /var/www/html
sudo chmod -R 755 /var/www/html
mysql -u root -p
Inside MySQL, run:
CREATE DATABASE osclass_db;
CREATE USER 'osclass_user'@'localhost' IDENTIFIED BY 'StrongPassword123!';
GRANT ALL PRIVILEGES ON osclass_db.* TO 'osclass_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Apache Virtual Host Configuration
sudo nano /etc/apache2/sites-available/osclass.conf
Add:
<VirtualHost *:80>
ServerName yourdomain.com
DocumentRoot /var/www/html
<Directory /var/www/html/>
AllowOverride All
Require all granted
Options -Indexes
</Directory>
</VirtualHost>
Enable the site:
sudo a2ensite osclass.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
Nginx Configuration
sudo nano /etc/nginx/sites-available/osclass
Add:
server {
listen 80;
server_name yourdomain.com;
root /var/www/html;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Enable the site:
sudo ln -s /etc/nginx/sites-available/osclass /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
http://yourdomain.com/oc-includes/osclass/install.php file after installation for security.Now, Osclass is installed and ready!
Use Memcached or Redis to improve page load speed:
sudo apt install memcached php-memcached -y
sudo systemctl restart apache2 # or nginx/php-fpm
In Osclass Admin Panel, enable caching under Settings > Performance.
For Apache:
sudo a2enmod deflate
sudo systemctl restart apache2
For Nginx (add to your server block):
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types text/plain text/css text/xml text/javascript application/json application/javascript application/xml+rss;
Restart Nginx: sudo systemctl restart nginx
Edit MySQL configuration:
sudo nano /etc/mysql/my.cnf
Add under [mysqld] section:
innodb_buffer_pool_size = 256M
query_cache_size = 64M
query_cache_limit = 4M
key_buffer_size = 64M
max_allowed_packet = 64M
Restart MySQL: sudo systemctl restart mysql
sudo apt install certbot python3-certbot-apache # Apache
sudo certbot --apache -d yourdomain.com
# or for Nginx
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com
sudo apt install fail2ban -y
sudo systemctl enable fail2ban
sudo nano /etc/ssh/sshd_config
# Change: PermitRootLogin no
sudo systemctl restart sshd
sudo apt update && sudo apt upgrade -y
| Task | Command/Steps |
|---|---|
| Update VPS | sudo apt update && sudo apt upgrade -y |
| Install LAMP/LEMP Stack | sudo apt install apache2 mysql-server php php-mysqli -y |
| Download Osclass | wget https://osclass-community.github.io/osclass/download/osclass.zip |
| Create MySQL Database | CREATE DATABASE osclass_db; |
| Configure Virtual Host | Edit /etc/apache2/sites-available/osclass.conf or /etc/nginx/sites-available/osclass |
| Set Permissions | sudo chown -R www-data:www-data /var/www/html |
| Enable HTTPS | certbot --apache -d yourdomain.com |
| Optimize Performance | Enable Memcached, GZIP compression, MySQL tuning |
Now your Osclass classifieds website is fully set up, optimized, and secured on a VPS!