The below i write the steps for add site or app in ubuntu server using git for deploy in git push for brach master.
- Log you ssh for access you machine
ssh youUser@youIp
- the next step is adding one directory in you machine, for this
mkdir diretório.git
- Now enter in you directore and create one git repository using the below command in terminal
git init --bare
- The next step is create one file .sh post-receive you body are the content the below
#!/bin/sh
GIT_WORK_TREE=/var/www/html/pathForFolderPuclicHtmlYouProject git checkout -f
- Write the command in you terminal for file are executable
chmod +x post-receive
- Now exit you connection ssh*
exit
- Are'in machine local, in this computer use the command git in you project for initialize one project managed
git init
- add remote local in you git project, in this case using connection ssh for this.
git remote add deploy ssh://root@IP/root/diretório.git
- I using deploy for brach master and developmenting in other branchs.*
- add files for commit, don't forget configurated .gitignore for ignore folders like nodemodules either vendors
git add *
- Now commit yours files and write one message funy
git commit -m "bla bla bla bla";
- The next step is push files for server, let's go.
git push -u deploy master
### I are using https://letsencrypt.org/
- adding the repository
sudo add-apt-repository ppa:certbot/certbot
- update you system
sudo apt update
- how to install letsencript
sudo apt install python-certbot-apache
- add two or more sites using flag -d
sudo certbot --apache -d example.com -d www.example.com
- renew certbot using command below
sudo certbot renew --dry-run
- To delete any certificate
certbot delete
- install apache in linux
apt-get install apache2
create directory for sites
sudo mkdir -p /var/www/html/youdirectoresite
- update permission in you directory
sudo chown -R $USER:$USER /caminho-completo-seu-diretorio
sudo chmod -R 755 /var/www/html
- Now next step is create the virtual hosts for you site/app than for this copy and past file 000-default.conf for example my-site-name.conf and add the configuration for the file
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Now in you terminal execute the command a2ensite name virtual host destination, the command a2dissite 000-default.conf remove you virtual host but don't forget the command below for restart you apache server.
sudo systemctl restart apache2
sudo service apache2 restart
below i writed the permissions for configuration laravel for expose files in the web, look like very good in 2019
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
open mysql in the terminal (just type mysql)
mysql -u root -p
Use the following command
ALTER USER 'username here'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password here';
Leave the password empty if you don't want a password.