Dicks Shit Tips – Host your Own Website 07/11/2022

Host your own Website without server Fees

total views 4,659 total views,  20 views today

apt install nginx

How to Host Your Own Website For Free!!!

https://www.proxmox.com/en/

https://www.balena.io/etcher/

 

Nginx ——–

apt install nginx
systemctl enable nginx
systemctl start nginx
systemctl status nginx

ufw allow http
ufw allow https

Apt install ufw

chown www-data:www-data /usr/share/nginx/html -R

MariaDB Database ——–

apt install mariadb-server mariadb-client
systemctl status mariadb
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation

mariadb -u root
exit;

PHP ———————

apt install php-imagick php7.4-fpm php7.4-mbstring php7.4-bcmath php7.4-xml php7.4-mysql php7.4-common php7.4-gd php7.4-json php7.4-cli php7.4-curl php7.4-zip php7.4 php7.4-fpm php7.4-mysql php-common php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-readline php7.4-mbstring php7.4-xml php7.4-gd php7.4-curl
systemctl start php7.4-fpm
systemctl enable php7.4-fpm
systemctl status php7.4-fpm

Nginx Server Block ————-

rm /etc/nginx/sites-enabled/default
nano /etc/nginx/conf.d/default.conf

server {
listen 80;
listen [::]:80;
server_name _;
root /usr/share/nginx/html/;
index index.php index.html index.htm index.nginx-debian.html;

location / {
try_files $uri $uri/ /index.php;
}

location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
include snippets/fastcgi-php.conf;
}

# A long browser cache lifetime can speed up repeat visits to your page
location ~* \.(jpg|jpeg|gif|png|webp|svg|woff|woff2|ttf|css|js|ico|xml)$ {
access_log off;
log_not_found off;
expires 360d;
}

# disable access to hidden files
location ~ /\.ht {
access_log off;
log_not_found off;
deny all;
}
}

systemctl reload nginx

systemctl restart nginx

mkdir -p /etc/systemd/system/nginx.service.d/

nano /etc/systemd/system/nginx.service.d/restart.conf

[Service]
Restart=always
RestartSec=5s

systemctl daemon-reload

wordpress ————–

wget https://wordpress.org/latest.zip
apt install unzip
mkdir -p /usr/share/nginx
unzip latest.zip -d /usr/share/nginx/
mv /usr/share/nginx/wordpress /usr/share/nginx/yourwebsitename.com

Config MariaDB
mariadb -u root
create database wordpress; ( or any name you want )
grant all privileges on wordpress.* to wpuser@localhost identified by ‘your-password’;
flush privileges;
exit;

wordpress
wpuser
your-password

cd /usr/share/nginx/yourwebsitename.com/
cp wp-config-sample.php wp-config.php
nano wp-config.php
chown www-data:www-data /usr/share/nginx/yourwebsitename.com/ -R
nano /etc/nginx/conf.d/yourwebsitename.com.conf

server {
listen 80;
listen [::]:80;
server_name yourwebsitename.com;
root /usr/share/nginx/yourwebsitename.com/;
index index.php index.html index.htm index.nginx-debian.html;

location / {
try_files $uri $uri/ /index.php;
}

location ~ ^/wp-json/ {
rewrite ^/wp-json/(.*?)$ /?rest_route=/$1 last;
}

location ~* /wp-sitemap.*\.xml {
try_files $uri $uri/ /index.php$is_args$args;
}

error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;

client_max_body_size 20M;

location = /50x.html {
root /usr/share/nginx/html;
}

location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
include snippets/fastcgi-php.conf;

# Add headers to serve security related headers
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection “1; mode=block”;
add_header X-Permitted-Cross-Domain-Policies none;
add_header X-Frame-Options “SAMEORIGIN”;
}

#enable gzip compression
gzip on;
gzip_vary on;
gzip_min_length 1000;
gzip_comp_level 5;
gzip_types application/json text/css application/x-javascript application/javascript image/svg+xml;
gzip_proxied any;

# A long browser cache lifetime can speed up repeat visits to your page
location ~* \.(jpg|jpeg|gif|png|webp|svg|woff|woff2|ttf|css|js|ico|xml)$ {
access_log off;
log_not_found off;
expires 360d;
}

# disable access to hidden files
location ~ /\.ht {
access_log off;
log_not_found off;
deny all;
}

}

systemctl reload nginx

admin
KN(3^332S0K&31iPrs

Increase size of files

sed -i ‘s/upload_max_filesize = 2M/upload_max_filesize = 2G/g’ /etc/php/7.4/fpm/php.ini

sed -i ‘s/post_max_size = 8M/post_max_size = 2G/g’ /etc/php/7.4/fpm/php.ini

systemctl restart php7.4-fpm

nano /etc/nginx/conf.d/yourwebsitename.com.conf

client_max_body_size 2M;

systemctl reload nginx

error: Content is protected !!