Websites > Manage > Advanced (sidebar) > GIT > Generate SSH
- Copy SSH key to your favorite git orchestrator
- Create a new repository on Hostinger
- Repository: Git repository SSH URL
- Branch: Name of the branch you want to copy
- Directory: the folder you want to put your repository (let
/
if you want to let thhe repository in your public_html or put your sub-domain name folder)
- Manage Repositories: Deploy
# install composer 2
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'e21205b207c3ff031906575712edab6f13eb0b361f2085f1f1237b7126d785e826a450292b6cfd1d64d92e6563bbde02') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
php composer.phar -V
cp .env.local.example .env.local
php composer.phar update
php bin/console d:m:m
# generate .htaccess file
php composer.phar req symfony/apache-pack
# if it is not generated, reinstall the package: php composer.phar remove symfony/apache-pack
# set the project to PROD
nano .env.local # APP_ENV=prod
# install/update vendors
php composer.phar install --no-dev --optimize-autoloader
php composer.phar dump-autoload --optimize --no-dev --classmap-authoritative
# clear cache
APP_ENV=prod APP_DEBUG=0 php bin/console cache:clear
# # run ENCORE package
# node_modules\.bin\encore production
nano .htaccess
# Install NodeJS & npm
# --> Test ca https://medium.com/@yatko/install-node-js-on-shared-hosting-65fb08deffad
# If error package. Compile locally `npm build` then send to server the `/public/build` folder.
Lets add .htaccess
file in the root folder (sub-domain):
<IfModule mod_rewrite.c >
RewriteEngine on
RewriteOptions inherit
# SSL and let's encrypt
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/.+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^.well-known/acme-challenge - [L]
# redirect to no-www
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# https redirect
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# redirect all requests to public directory
RewriteCond %{REQUEST_URI} !public/
RewriteRule (.*) /public/$1 [L]
</IfModule>
Lets add .htaccess
file in the root folder (public_html):
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# To redirect to the index home page (specify th direct path to index.php)
DirectoryIndex encyclodofus/public/index.php
# Rediriger les requêtes vers le dossier public de manière transparente
RewriteCond %{REQUEST_URI} !^/encyclodofus/public/ [NC]
# Rediriger /encyclodofus/public/item/ vers /item/
# RewriteCond %{REQUEST_URI} ^/encyclodofus/public/item [NC]
RewriteRule ^encyclodofus/public/(.*)$ /$1 [R=301,L]
# Rediriger les requêtes vers le dossier public de manière transparente
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ encyclodofus/public/$1 [L]
</IfModule>