# Setting up OpenQP using nginx, postgresql and php on a newly installed Ubuntu 20.04 # All commands are issued as root user # I use the text editor 'joe', use your choice. # install the required debian packages apt update # Skip this if you have a Web server, PHP and postgresql already installed. apt install joe nginx certbot python3-certbot-nginx postgresql php-common php-fpm # Required for both the Server and client apt install texlive-xetex fonts-smc-rachana fonts-deva fonts-lohit-deva texlive-lang-arabic fonts-noto-core fonts-sil-scheherazade php-pgsql python3-psycopg2 python3-numpy # Only for the client desktop apt install python3-pyqt5 #---------------------------- may skip this if web server is already running ---- # firewall configuration ufw default deny incoming; ufw default allow outgoing; ufw allow OpenSSH; ufw allow 'Nginx Full'; ufw allow 5432/tcp ufw enable; # Nginx configuration files joe /etc/nginx/sites-available/default # This is the content of a working configuration file. server { listen 80; listen [::]:80; root /var/www/html; index index.php index.html index.htm; server_name openqp.scischool.in; # for PHP7.4 access location ~[^/]\.php(/|$) { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; fastcgi_read_timeout 600; } } systemctl restart nginx certbot --nginx -d your_site_name # get the free TLS certificate, for https ------------------------------------------------------------------------------ copy the following files to /var/www/html/KUQP index.php second.php qgen.php Qpgen.py chown -R www-data:www-data /var/www/html/KUQP # write permission for web server # Set the postgres HBA configuration to allow a connection using TCP/IP protocol /etc/postgresql/12/main/pg_hba.conf should have the following lines local all all password host all all 127.0.0.1/32 password host all all 0.0.0.0/0 password Modify /etc/postgresql/12/main/postgresql.conf , to have the line listen_addresses = '*' # what IP address(es) to listen on; systemctl restart postgresql # Become the postgres user and use 'psql' client to make the database etc. sudo -su postgres $ psql # DB is the database name and user name. Change it as you wish For postgresql 12 (ubunto 20.04) postgres=# create role DB with createrole login password '******'; postgres=# create database DB; postgres=# grant all on database DB to DB; postgres=# create user dummy with password 'dum123'; postgres=# create user reader with password 'rea123'; postgres=# \q for pastegres 16 or later (ubunto 24.04) postgres=# create role DB with createrole login password '******'; postgres=# create database kuqbank owner kuqbank; postgres=# create user dummy with password 'dum123'; postgres=# create user reader with password 'rea123'; On the client side: Files Required initQbank.py Initializes the database, used only once. Qadmin.py. Creates new courses or delete existing ones. qbc.py. Does the editing of questions in the database.