Docs
https://www.bluehost.com/blog/how-to-set-up-a-vps/
https://www.bluehost.com/help/article/dns-records-explained
Here’s a clear, practical way to add SSL (HTTPS) to a server on Ubuntu. The most common and easiest method is using Certbot with Let's Encrypt (free SSL certificates).
sudo apt update
sudo apt upgrade -y
sudo apt install certbot python3-certbot-nginx -y
sudo apt install certbot python3-certbot-apache -y
sudo certbot --nginx
sudo certbot --apache
You’ll be prompted to:
Open your site:
https://yourdomain.com
Let’s Encrypt certs expire every 90 days, but auto-renew is usually set up automatically.
Test it:
sudo certbot renew --dry-run
If you're not using Apache/Nginx automation:
sudo certbot certonly --standalone -d yourdomain.com
Certificates will be stored in:
/etc/letsencrypt/live/yourdomain.com/
Then configure your server manually with:
fullchain.pem
privkey.pem
Make sure:
sudo ufw allow 80
sudo ufw allow 443
sudo systemctl stop nginxNotes:$ apt install apache2 openssl
$ a2enmod ssl
$ systemctl restart apache2
$ apt install certbot python3-certbot-apache
$ certbot --apache
To host both PHP and Django sites on the same Apache server, you just need to configure Apache to handle each type of application differently.
Here’s how it works in practice:
Apache can serve:
mod_php or PHP-FPM
mod_wsgi)
Each site gets its own virtual host configuration.
Handled normally with PHP enabled:
<VirtualHost *:80>
ServerName php-site.com
DocumentRoot /var/www/php-site
<Directory /var/www/php-site>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Uses mod_wsgi to run the Django app:
<VirtualHost *:80>
ServerName django-site.com
WSGIDaemonProcess django_site python-home=/var/www/django-site/venv python-path=/var/www/django-site
WSGIProcessGroup django_site
WSGIScriptAlias / /var/www/django-site/project/wsgi.py
<Directory /var/www/django-site/project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /static /var/www/django-site/static
<Directory /var/www/django-site/static>
Require all granted
</Directory>
</VirtualHost>
example.com → PHP
app.example.com → Django
collectstatic)
Many modern setups use:
gunicorn or uwsgi
This gives better scalability and separation.
Yes—you can run both on the same Apache server by:
On Ubuntu this is very straightforward. I’ll walk you through a clean, practical setup where Apache hosts both a PHP site and a Django app.
sudo apt update
sudo apt install apache2 php libapache2-mod-php python3 python3-venv python3-pip libapache2-mod-wsgi-py3
Enable Apache modules:
sudo a2enmod wsgi
sudo a2enmod rewrite
sudo systemctl restart apache2
Create a directory:
sudo mkdir -p /var/www/php-site
sudo chown -R $USER:$USER /var/www/php-site
Test PHP:
echo "<?php phpinfo(); ?>" > /var/www/php-site/index.php
Create config:
sudo nano /etc/apache2/sites-available/php-site.conf
<VirtualHost *:80>
ServerName php.local
DocumentRoot /var/www/php-site
<Directory /var/www/php-site>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Enable it:
sudo a2ensite php-site
mkdir -p /var/www/django-site
cd /var/www/django-site
python3 -m venv venv
source venv/bin/activate
pip install django
django-admin startproject project .
Test locally:
python manage.py runserver
sudo nano /etc/apache2/sites-available/django-site.conf
<VirtualHost *:80>
ServerName django.local
WSGIDaemonProcess django_site python-home=/var/www/django-site/venv python-path=/var/www/django-site
WSGIProcessGroup django_site
WSGIScriptAlias / /var/www/django-site/project/wsgi.py
<Directory /var/www/django-site/project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
Alias /static /var/www/django-site/static
<Directory /var/www/django-site/static>
Require all granted
</Directory>
</VirtualHost>
Edit settings:
ALLOWED_HOSTS = ["django.local"]
STATIC_ROOT = "/var/www/django-site/static"
Then:
python manage.py collectstatic
sudo a2ensite django-site
sudo systemctl reload apache2
Edit your hosts file:
sudo nano /etc/hosts
Add:
127.0.0.1 php.local
127.0.0.1 django.local
sudo chown -R www-data:www-data /var/www/django-site
Make sure:
collectstatic was run
Alias /static is correct
This works well, but many production setups prefer:
More scalable, but slightly more complex.
You’ll have:
http://php.local → PHP site
http://django.local → Django app
Running on the same Apache server without conflict.
To install Keras on a Mac, install TensorFlow (which includes Keras) using
pip install tensorflow
or
pip install tensorflow-macos for Apple Silicon (M1/M2/M3) chips.
For best performance on M1/M2/M3 chips, use conda to install tensorflow-deps.
Verify with python -c "import keras; print(keras.__version__)"
== Use PIP (Standard & Apple Silicon)
# Upgrade pip
pip3 install --upgrade pip
# Install TensorFlow (includes Keras)
pip3 install tensorflow Note: TensorFlow works with Python 3.9-2.12. The recommended way to install and manage multiple Python versions on a Mac is by using a version manager like pyenv, which prevents conflicts with the system's default Python installation.
== Use pyenv (Recommended for Developers)
brew install pyenv
You may also want the pyenv-virtualenv plugin for creating isolated project environments:
bash brew install pyenv-virtualenv
Configure your shell: You need to initialize pyenv in your shell (e.g., Zsh, the default for modern macOS). Add the necessary lines to your shell's configuration file (commonly ~/.zshrc or ~/.bashrc) and restart your terminal as per the pyenv documentation instructions.
pyenv install 3.12.0
Switch between versions:
pyenv global 3.12.0
.python-version file:pyenv local 3.12.0
pyenv-virtualenv to create an isolated environment for a project with a specific Python version:pyenv virtualenv 3.12.0 myprojectenv
cd myprojectdir
pyenv local myprojectenv
Create local env:
# Create a virtual environment (e.g., named 'tf-env')
python -m venv tf-env
# Activate it (Linux/macOS)
source tf-env/bin/activate Then install:pip install tensorflow Verify:import tensorflow as tfprint(tf.keras.__version__)print(tf.__version__)
AI Overview
8080 or 81, while the other (e.g., Nginx) uses the default 80 (HTTP) and 443 (HTTPS) ports. Users would access the second server by appending the port number to the URL (e.g., http://yourdomain.com:8080).80 and 443. It serves static files directly and proxies requests for dynamic content (like PHP applications that rely on .htaccess files) to Apache, which is configured to listen on an internal, loopback IP and port (e.g., 127.0.0.1:8080). This setup improves overall performance and resource usage. ports.conf and the default virtual host file) to change the listening ports from 80/443 to an internal port like 8080.80/443.
For dynamic requests, add proxy directives within the Nginx virtual
host configuration to forward traffic to the Apache port (e.g., proxy_pass http://localhost:8080;).mod_rpaf (or mod_remoteip) on Apache:
This module ensures Apache logs the client's real IP address instead of
Nginx's localhost IP, which is useful for statistics and
authentication.
sudo apt updatesudo apt install nodejs npmnode -v and npm -vnpm run build. This creates a production-optimized build directory. Transfer the contents of this build directory to your Ubuntu server using tools like scp, rsync, or by cloning your repository from GitHub on the server itself.sudo apt install nginxsudo systemctl start nginx and sudo systemctl enable nginx/etc/nginx/sites-available/ directory. You can use a text editor like nano (e.g., sudo nano /etc/nginx/sites-available/your_domain):server {
listen 80;
server_name your_domain www.your_domain;
root /var/www/your_domain/html;
index index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
}
your_domain with your actual domain name and adjust the root path to where you placed your build files, for example, /var/www/your_domain/html).sites-available to the sites-enabled directory:sudo ln -s /etc/nginx/sites-available/your_domain /etc/nginx/sites-enabled/sudo nginx -tsudo systemctl restart nginx