Osclass is an open-source classified ads script that allows users to create and manage their own classified ad websites for various niches, including:
Since Osclass is self-hosted, you need a server environment that supports its PHP and MySQL requirements.
Osclass runs best on LAMP (Linux, Apache, MySQL, PHP) or LEMP (Linux, Nginx, MySQL, PHP) stack.
| Component | Minimum Requirement |
|---|---|
| OS | Ubuntu 20.04+, CentOS 7+, Debian 10+ |
| Web Server | Apache 2.4+ or Nginx 1.18+ |
| PHP | 7.4+ (8.0 recommended) |
| Database | MySQL 5.7+ or MariaDB 10+ |
| RAM | 2GB+ (4GB+ for high traffic) |
VPS is recommended for better performance and scalability instead of shared hosting.
If you are setting up a dedicated server or VPS, follow these steps:
sudo apt update && sudo apt upgrade -y
sudo apt install apache2 mariadb-server php php-mysql php-xml php-mbstring php-gd unzip -y
sudo apt install nginx mariadb-server php php-fpm php-mysql php-xml php-mbstring php-gd unzip -y
cd /var/www/
wget https://github.com/navjottomer/Osclass/releases/latest/download/osclass.zip
unzip osclass.zip -d osclass
rm osclass.zip
sudo chown -R www-data:www-data /var/www/osclass
sudo chmod -R 755 /var/www/osclass
sudo nano /etc/apache2/sites-available/osclass.conf
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/osclass
ServerName yourdomain.com
ServerAlias www.yourdomain.com
<Directory /var/www/osclass>
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
sudo a2ensite osclass.conf
sudo systemctl restart apache2
sudo nano /etc/nginx/sites-available/osclass
server {
listen 80;
server_name yourdomain.com www.yourdomain.com;
root /var/www/osclass;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
sudo ln -s /etc/nginx/sites-available/osclass /etc/nginx/sites-enabled/
sudo systemctl restart nginx
sudo mysql_secure_installation
Follow the prompts to remove default settings and set a root password.
sudo mysql -u root -p
Then run:
CREATE DATABASE osclass_db;
CREATE USER 'osclass_user'@'localhost' IDENTIFIED BY 'strongpassword';
GRANT ALL PRIVILEGES ON osclass_db.* TO 'osclass_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
http://yourdomain.com/
/oc-admin/ to something unique.If using Apache:
sudo a2enmod ssl
sudo systemctl restart apache2
For Nginx, add:
listen 443 ssl;
ssl_certificate /etc/ssl/certs/yourdomain.pem;
ssl_certificate_key /etc/ssl/private/yourdomain.key;
Then restart Nginx:
sudo systemctl restart nginx
php.ini:
memory_limit = 256M
max_execution_time = 300
sudo mysqltuner
| Step | Action |
|---|---|
| 1 | Set up a VPS with LAMP or LEMP stack |
| 2 | Download and configure Osclass |
| 3 | Configure Apache or Nginx |
| 4 | Set up a MySQL database |
| 5 | Install Osclass through a web browser |
| 6 | Secure and optimize performance |
| Issue | Solution |
|---|---|
| 500 Internal Server Error | Check Apache/Nginx error logs (/var/log/apache2/error.log or /var/log/nginx/error.log). |
| Database Connection Failed | Ensure the database name, user, and password are correct in Osclass settings. |
| File Permission Errors | Run sudo chown -R www-data:www-data /var/www/osclass. |
| Slow Performance | Enable caching and optimize MySQL settings. |
| SSL Not Working | Ensure the SSL certificate is correctly installed and enabled. |
By following these detailed steps, you can successfully host Osclass on your own VPS or dedicated server, ensuring a fast, secure, and scalable classified ads website.