Static Pages

L.L.L.P


$ apt-get update --allow-releaseinfo-change -y
$ apt-get install --reinstall ca-certificates -y
$ apt-get upgrade -y
$ apt-get install nano wget curl perl sudo -y

$ sudo apt -y dist-upgrade
$ sudo apt --purge autoremove -y
$ sudo apt update && sudo apt upgrade -y
$ apt -y purge Apache2* bind* exim* ufw firewalld libapache2-mod-php*

$ adduser lighttpd
$ adduser lighttpdsudo
$ su - lighttpd
$ exit

1. ============Install DB================
$ apt install mariadb-server mariadb-client -y
$ systemctl start mariadb
$ systemctl enable mariadb
$ systemctl status mariadb

$ mysql_secure_installation
type y to set the root password
$ mariadb -u rootexit; 

2. ==========Install PHP==================
$ sudo apt -y install php software-properties-common 
$ sudo apt -y install php-common php-mysql php-xml php-xmlrpc php-curl php-gd php-imagick php-cli php-fpm php-json php-imap php-mbstring php-opcache php-soap php-dev php-cgi php-zip php-intl php-bcmath php-pear 
$ sudo apt -y install libmcrypt-dev libreadline-dev mcrypt 
$ sudo apt -y install php8.2 php8.2-fpm php8.2-common php8.2-mysql php8.2-xml php8.2-xmlrpc php8.2-curl php8.2-gd php8.2-cli php8.2-dev php8.2-imap php8.2-mbstring php8.2-soap php8.2-zip php8.2-cgi 
$ sudo apt -y install php7.4 php7.4-fpm php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc 
$ sudo apt -y install php7.4-curl php7.4-gd php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring 
$ sudo apt -y install php7.4-soap php7.4-zip php7.4-cgi

3. =============Install Lighttpd======================= 
$ apt-get install lighttpd -y 
$ systemctl start lighttpd 
$ systemctl enable lighttpd 
$ systemctl status lighttpd 
go to http://your-server-ip

$ apt -y purge Apache2* bind* exim* ufw firewalld libapache2-mod-php*
**if it doesn't have space, check */var/cache/* and **/var/log(except Apache2)** clean crap!**
# if you want to use php-fpm; Use PHP-FPM service for PHP via FastCGI
$ sudo systemctl restart php8.2-fpm
$ sudo lighty-enable-mod fastcgi fastcgi-php-fpm
$ nano /etc/php/8.2/fpm/php.ini
     uncomment
     cgi.fix_pathinfo=1

$ sudo service lighttpd force-reload
$ sudo nano /etc/lighttpd/conf-available/15-fastcgi-php-fpm.conf
       fastcgi.server += ( ".php" =>
              ((
                  "socket" => "/run/php/php8.2-fpm.sock",
                  "broken-scriptfilename" => "enable"
             ))
       )
$ sudo systemctl restart lighttpd
$ sudo nano /var/www/html/test.php
http://your i.p/test.php

4. ============Lighttpd conf=====================================
$ nano /etc/lighttpd/lighttpd.conf
   server.module += ("mod_rewrite")

    server.document-root = "/home/lighttpd/"   OR  "/var/www/html/"
    server.port = 80
    server.bind = "72.12.5.10" 
    ---//At the bottom of the file, add:---------
    include "domain1.conf"     //include "domain2.conf"  and many more...

5. =========Making Website========================
# mkdir -p /home/lighttpd                
# mkdir -p /home/lighttpd/domain1        OR "/var/www/html/domain1"
# mkdir -p /home/lighttpd/domain1/logs   OR "/var/www/html/domain1/logs"

# nano /etc/lighttpd/domain1.conf and paste
  $HTTP["host"] =~ "domain1\.com" {
    server.document-root = "/home/lighttpd/domain1"                 OR "/var/www/html/domain1"
    accesslog.filename = "/home/lighttpd/domain1/logs/access.log"   OR "/var/www/html/domain1/logs"
    }

# chown -R lighttpd:lighttpd /home/lighttpd/domain1  // don't forget!!!
OR chown -R lighttpd:lighttpd /var/www/html/domain1
# chmod -R 755 /home/lighttpd/domain   OR chmod -R 755 /var/www/html/domain1
# systemctl restart lighttpd
================================================
Install Grav

$ wget https://getgrav.org/download/core/grav-admin/latest -O grav-admin.zip
$ unzip grav-admin.zip -d grav
$ mv grav grav2
$ mv grav2/grav-admin/ /var/www/html/grav
$ rm -rf grav2/
$ nano /etc/lighttpd/lighttpd.conf
add server.module += ("mod_rewrite")

$HTTP["host"] =~ ".*" {
    server.document-root = "/var/www/html/grav"
    url.rewrite-if-not-file = ( "" => "/index.php" )
}
  at bottom add    include "domain1.conf" 

$ chown -R www-data:www-data /var/www/html/grav
$ chmod -R 755 /var/www/html/grav

$ nano /etc/lighttpd/domain1.conf and paste

  $HTTP["host"] =~ "domain1\.com" {
    server.document-root = "/var/www/html/grav"
    accesslog.filename = "/var/www/html/grav/logs"
    }

$ systemctl restart lighttpd
=======================================
Install Ghost

$ sudo useradd -m -s /bin/bash ghostadmin
$ passwd ghostadmin
$ sudo su - ghostadmin

$ curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
$ sudo apt-get install -y nodejs
$ node -v
$ sudo apt-y install.npm
$ sudo npm install npm@latest -g
$ npm -v

$ sudo mysql -u root -p
    CREATE DATABASE ghost;
    CREATE USER 'ghostadmin'@'localhost' IDENTIFIED BY 'password';
    GRANT ALL PRIVILEGES ON ghost.* TO 'ghostadmin'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;

$ sudo npm install ghost-cli@latest -g
$ ghost --version

$ sudo mkdir -p /var/www/html/domain
$ sudo chown $USER:$USER /var/www/html/domain
$ sudo chmod 775 /var/www/html/domain
$ sudo su - ghostadmin
$ cd /var/www/html/domain
$ ghost install

    Blog URL (e.g., https://force.youreyesonly.xyz)
    MySQL hostname (localhost)
    MySQL username and password (ghost andibutt1986)
    Ghost database name (ghost)

6. =========Install Webmin===============
$ curl -o setup-repos.sh https://raw.githubusercontent.com/webmin/webmin/master/setup-repos.sh
$ sh setup-repos.sh
$ apt -y install webmin --install-recommends
( change port: $ sudo nano -w /etc/webmin/miniserv.conf )

====Install PhpMyadmin on Debian($ sudo apt-get purge adminer)====
sudo apt install phpmyadmin -y
sudo dpkg --configure -a
sudo apt -y autoremove
$ sudo ln -s /usr/share/phpmyadmin/ /home/lighttpd/
($ sudo ln -s /usr/share/phpmyadmin/ /var/www/html/)
$ cd /home/lighttpd/phpmyadmin
($ cd /var/www/html/phpmyadmin)
$ ls
$ sudo cp config-example.inc.php config.inc.php
$ sudo nano config.inc.php
  $cfg['blowfish_secret'] = '';
$ sudo rm -rf /setup
$ chown -R www-data:www-data /home/lighttpd/phpmyadmin  // don't forget!!! # 
(chown -R www-data:www-data /var/www/html/phpmyadmin )
http://i.p addr/phpmyadmin
OR
$ sudo mv /usr/share/phpmyadmin/* /home/lighttpd/domain  //it will transfer all the files to domain.
$ cd /home/lighttpd/domain
$ ls //see if all the files there
  $cfg['blowfish_secret'] = '';
http://domain
$ chown -R www-data:www-data /home/lighttpd/domain  // don't forget!!! # 
$ systemctl restart lighttpd
mysql -u root -p
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT ALL ON wordpress.* TO 'user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON *.* TO 'user'@'localhost';
FLUSH PRIVILEGES;
exit;
============Getting different version of PHP=========================
$ apt -y install apt-transport-https lsb-release ca-certificates
$ wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
$ echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | 
sudo tee /etc/apt/sources.list.d/php.list

$ sudo apt -y upgrade
$ sudo apt-get -y purge php8.*
$ sudo apt-get -y purge php5.6*
$ sudo apt-get -y autoclean
$ sudo apt-get -y autoremove   

Set Default PHP Version
$ sudo update-alternatives --set php /usr/bin/php7.4
$ php -v
$ php -i | grep "Loaded Configuration File"

$ a2dismod php5.6
$ a2enmod php5.6