Billing
LXC Proxmox container using ubuntu 22.04
sudo apt clean
audo apt autoremove
cd /etc/ssh
sudo rm ssh_host_*
cat /etc/machine-id
sudo truncate -s 0 /etc/machine-id
sudo adduser ahmad sudo usermod -aG sudo ahmad sudo -i -u ahmad
sudo poweroff
convert to template
for ssh connection
ssh-keygen -A
https://www.technewstoday.com/port-22-connection-refused/
sudo nano /etc/ssh/sshd_config
uncomment the port and listen address
sudo apt update && sudo apt upgrade -y && sudo systemctl restart ssh.service && sudo ufw enable && sudo ufw allow 22 && sudo ufw reload && ip add
make dhcp lease static from winbox
ip -> DHCP SERVER -> Leases -> double click on ip -> make static
https://bitlaunch.io/blog/fix-warning-remote-host-identification-has-changed/
Error on client side
REMOTE HOST IDENTIFICATION HAS CHANGED!
solution: show b run on client side ssh-keygen -R “192.168.88.246”
Creating Systemuser
https://linuxize.com/post/how-to-create-users-in-linux-using-the-useradd-command
sudo useradd -m -d /opt/sms01 -U -r -s /bin/bash sms01
First set the password for newely created user
sudo passwd username
change user sudo su - sms01
adding user to sudoers
https://linuxize.com/post/how-to-add-user-to-sudoers-in-ubuntu
usermod -aG sudo username
Extra options
sudo useradd -u 1500 username id -u username
Installing mariadb 10.6 (LTD) 19-oct-2022
sudo apt update && sudo apt upgrade -y
sudo apt install dirmngr ca-certificates software-properties-common gnupg gnupg2 apt-transport-https curl -y
curl -fsSL https://mariadb.org/mariadb_release_signing_key.asc | gpg –dearmor | sudo tee /usr/share/keyrings/mariadb.gpg > /dev/null 2>&1
echo deb [arch=amd64,arm64,ppc64el,s390x signed-by=/usr/share/keyrings/mariadb.gpg] http://mirror.mariadb.org/repo/10.6/ubuntu/ jammy main | sudo tee /etc/apt/sources.list.d/mariadb.list
sudo apt update
sudo apt install mariadb-server mariadb-client -y
mariadb –version
systemctl status mariadb
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo mysql_secure_installation
Enabling remote access to mysql/mariadb
sudo mysql
ps -ef | grep -i mysql netstat -ant | grep 3306 root@mariadb1:/etc/mysql/mariadb.conf.d# sudo nano 50-server.cnf
GRANT ALL ON . to root@‘192.168.88.246’ IDENTIFIED BY ‘P@kistan2541’;
FLUSH PRIVILEGES;
Connecting mariadb with windows Client
https://filecr.com/windows/dbeaver-ultimate
heidisql.com
Uninstall mariadb
sudo apt autoremove mariadb-server mariadb-client –purge -y sudo rm /etc/apt/sources.list.d/mariadb.list /usr/share/keyrings/mariadb.gpg
Installing apache
sudo apt update
sudo apt install apache2
sudo ufw app list
sudo ufw allow in “Apache”
sudo ufw status
Find your Serverβs Public IP Address
ip addr show ens3 | grep inet | awk ‘{ print $2; }’ | sed ’s//.*$//’
curl http://icanhazip.com
PHP
sudo apt install php libapache2-mod-php php-mysql
php -v
Apache settings
With the default DirectoryIndex settings on Apache, a file named index.html will always take precedence over an index.php file. This is useful for setting up maintenance pages in PHP applications, by creating a temporary index.html file containing an informative message to visitors. Because this page will take precedence over the index.php page, it will then become the landing page for the application. Once maintenance is over, the index.html is renamed or removed from the document root, bringing back the regular application page.
sudo nano /etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c>
DirectoryIndex index index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
sudo systemctl reload apache2
installing phpMyAdmin
sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl
sudo phpenmod mbstring
sudo systemctl restart apache2
https://your_domain_or_IP/phpmyadmin
Installing NGINX Webserver for wordpress
https://www.linuxcapable.com/install-wordpress-with-nginx-mariadb-php-on-ubuntu-22-04-lts/
sudo apt update && sudo apt upgrade -y
sudo apt install curl git wget unzip -y
apt install software-properties-common
sudo add-apt-repository ppa:ondrej/nginx-mainline -y
php on nginx server on ubuntu 22.04
sudo apt install php8.1-fpm php8.1-cli php8.1-common php8.1-mbstring php8.1-xmlrpc php8.1-soap php8.1-gd php8.1-xml php8.1-intl php8.1-mysql php8.1-cli php8.1-ldap php8.1-zip php8.1-curl php8.1-opcache php8.1-readline php8.1-xml php8.1-gd -y
systemctl status php8.1-fpm
Error
"The uploaded file exceeds the upload_max_filesize directive in php.ini."
https://stackoverflow.com/questions/2184513/change-the-maximum-upload-file-size
nano /etc/php/8.1/fpm/php.ini
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
max_execution_time = 300
max_input_time = 60
memory_limit = 256M
post_max_size = 256M
upload_max_filesize = 256M
in wp-config.php
@ini_set('upload_max_size' , '256M' );
wget https://wordpress.org/wordpress-6.0.3.zip
sudo unzip wordpress-6.0.3.zip -d /var/www/html/
mv wordpress brift
sudo chown -R www-data:www-data /var/www/html/wordpress/
Set chmod permission folders (important):
sudo find /var/www/html/wordpress -type d -exec chmod 755 {} ;
Set chmod permission files (important):
sudo find /var/www/html/wordpress -type f -exec chmod 644 {} ;
cd /var/www/html/wordpress/
sudo cp wp-config-sample.php wp-config.php
sudo nano /etc/nginx/sites-available/example.com.conf
sudo ln -s /etc/nginx/sites-available/example.com.conf /etc/nginx/sites-enabled/
Trouble shootings
https://stackoverflow.com/questions/19285355/nginx-403-error-directory-index-of-folder-is-forbidden
Change the try_files to point to the index.php path, in the "Laravel" that you mentioned it should be something like this
location / {
# i did this for wordpress
try_files $uri $uri/ /var/www/html/brift/index.php$request_uri;
}
And in the "codeigniter" project try it like this
location / {
try_files $uri $uri/ /public_web/index.php$request_uri;
}
https://www.thegeekdiary.com/nginx-504-gateway-time-out/
504 gateway timeout nginx 1.23.2 wordpress
location ~ \.php$ {
fastcgi_pass unix:/tmp/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_read_timeout 300; #Solved my issue coverted **504 to error establishing a database connection**
}
504 to error establishing a database connection
netstat -ant | grep 3306 root@mariadb1:/etc/mysql/mariadb.conf.d# sudo nano 50-server.cnf
GRANT ALL ON . to root@‘192.168.88.249’ IDENTIFIED BY ‘P@kistan2541’;
FLUSH PRIVILEGES;
# https://kinsta.com/knowledgebase/wordpress-change-url/
# media was not loading like css and images etc
# In your wp-config.php file, add these two lines somewhere above the line that tells you to stop editing:
# don't use https
# https will make "ERR_TOO_MANY_REDIRECTS" error behind traefik
define( 'WP_HOME', 'http://yoursiteurl.com' );
define( 'WP_SITEURL', 'http://yoursiteurl.com' );
Adding another wordpress website to same wordpress node
step one
login to nginx container
Copy the wordpress/website content to new folder with the following command
sudo cp -rd brift tabeaat
now change permissions of this newely copied folder.
Always double check the permission on folders inside your website folders too by
ls -alh
sudo chown -R www-data:www-data /var/www/html/wordpress/ sudo find /var/www/html/wordpress -type d -exec chmod 755 {} ; sudo find /var/www/html/wordpress -type f -exec chmod 644 {} ;
change the wp-config.php in new website folder.
copy the existing working config to new file cp brift.consulting.conf tabeaat.com.conf sudo nano /etc/nginx/sites-available/example.com.conf sudo ln -s /etc/nginx/sites-available/example.com.conf /etc/nginx/sites-enabled/
add domain to .env add domain to docker-compose.conf
- --entrypoints.https.http.tls.domains[1].main=$DOMAINNAME_OPTIMUS_GASSES
- --entrypoints.https.http.tls.domains[1].sans=*.$DOMAINNAME_OPTIMUS_GASSES
create new file in rules directory by copying existing config
Installing Postgresql
os ubuntu 22.04 (lxc container on proxmox)
decided not to install pg admin on container but connect remotely from my home network to container… install pgadmin on my workstation instead.
sudo apt update sudo apt -y full-upgrade
Check if a reboot is required after the upgrade
[ -f /var/run/reboot-required ] && sudo reboot -f
sudo apt install postgresql postgresql-contrib postgresql-client
sudo -u postgres psql -c “SELECT version();”
Enable Remote Access to PostgreSQL server
sudo nano /etc/postgresql/12/main/postgresql.conf
#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#------------------------------------------------------------------------------
# - Connection Settings -
listen_addresses = '*' # what IP address(es) to listen on;
sudo service postgresql restart
Testing again services ss -nlt | grep 5432
/etc/postgresql/12/main/pg_hba.conf
you can also edit pg_hba.conf with single line
sudo bash -c "echo host all all 0.0.0.0/0 md5 >> /etc/postgresql/14/main/pg_hba.conf"
# Database administrative login by unix domain socket
# TYPE DATABASE USER ADDRESS METHOD
local all postgres peer
local all all md5
# The user jane can access all databases from all locations using md5 password
host all jane 0.0.0.0/0 md5
# The user jane can access only the janedb from all locations using md5 password
host janedb jane 0.0.0.0/0 md5
host moodle moodle_admin 0.0.0.0/0 md5
host sis sis_admin 0.0.0.0/0 md5
# The user jane can access all databases from a trusted location (192.168.1.134) without a password
host all jane 192.168.1.134 trust
#example from moodle docs page https://docs.moodle.org/310/en/PostgreSQL
host moodle moodleuser 127.0.0.1/32 password
sudo service postgresql restart
pgAdmin
# try sometime maybe again..
// left at when nginx and gunicorn config
<https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-pgadmin-4-in-server-mode-on-ubuntu-22-04>
Installing Odoo
sudo apt install git python3-pip build-essential wget python3-dev python3-venv
python3-wheel libfreetype6-dev libxml2-dev libzip-dev libldap2-dev libsasl2-dev
python3-setuptools node-less libjpeg-dev zlib1g-dev libpq-dev
libxslt1-dev libldap2-dev libtiff5-dev libjpeg8-dev libopenjp2-7-dev
liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev libxcb1-dev postgresql-contrib postgresql-client
sudo useradd -m -d /opt/odoo16 -U -r -s /bin/bash odoo16
sudo apt-get -y install wkhtmltopdf
git clone https://github.com/odoo/odoo.git –depth 1 –branch 16.0 –single-branch odoo-server
# /etc/systemd/system/odoo16.service
[Unit]
Description=Odoo16
[Service]
Type=simple
SyslogIdentifier=odoo16
PermissionsStartOnly=true
User=odoo16
Group=odoo16
ExecStart=/opt/odoo16/odoo-venv/bin/python3 /opt/odoo16/odoo/odoo-bin -c /etc/odoo16.conf
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target
# /etc/odoo16.conf
[options]
; This is the password that allows database operations:
admin_passwd = P@kistan2541
db_host = 192.168.88.247
db_port = 5432
db_user = admin
db_password = kakarr
logfile = /var/log/odoo/odoo.log
addons_path = /opt/odoo16/odoo/addons,/opt/odoo16/odoo-custom-addons
Adding theme to website after installing odoo
https://github.com/odoo/design-themes
Add in to addons folders
/opt/odoo15/odoo/odoo/addons
misculanious
wp-config.php define( ‘UPLOADS’, ‘wp-content/uploads’ ); just above this line:
wp-config.php require_once(ABSPATH . ‘wp-settings.php’);
Error “you are offline” when trying to create new page
I can say I was lucky, been looking at this problem all of last week, then took a break until tonight where I see your answer that was posted today!
Your solution did not work for me, but I went to the link in your comment (// see also <http://codex.wordpress.org/Administration_Over_SSL#Using_a_Reverse_Proxy>) and found this, that worked for me (added in wp-config.php):
define('FORCE_SSL_ADMIN', true);
// in some setups HTTP_X_FORWARDED_PROTO might contain
// a comma-separated list e.g. http,https
// so check for https existence
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
$_SERVER['HTTPS']='on';