Last active
March 23, 2020 09:28
-
-
Save MostafaEzzelden/c63e15f67ae7b52c5fa5c71cef22f39b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@desktop:~# sudo -su | |
root@desktop:~# apt update | |
root@desktop:~# apt install nginx | |
root@desktop:~# apt install mysql-server-5.7 | |
root@desktop:~# mysql_secure_installation | |
# to login in your mysql type | |
root@desktop:~# mysql -uroot -p | |
# to change authentication plugin for root password | |
root@desktop:~# mysql | |
mysql> SELECT user,authentication_string,plugin,host FROM mysql.user; | |
+------------------+-------------------------------------------+-----------------------+-----------+ | |
| user | authentication_string | plugin | host | | |
+------------------+-------------------------------------------+-----------------------+-----------+ | |
| root | | auth_socket | localhost | | |
+------------------+-------------------------------------------+-----------------------+-----------+ | |
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'PASSWORD'; | |
mysql> FLUSH PRIVILEGES; | |
mysql> SELECT user,authentication_string,plugin,host FROM mysql.user; | |
+------------------+-------------------------------------------+-----------------------+-----------+ | |
| user | authentication_string | plugin | host | | |
+------------------+-------------------------------------------+-----------------------+-----------+ | |
| root | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | mysql_native_password | localhost | | |
+------------------+-------------------------------------------+-----------------------+-----------+ | |
mysql> exit | |
root@desktop:~# apt install php-fpm php-mysql | |
root@desktop:~# apt install php-curl php-gd php-intl php-mbstring php-soap php-xml php-xmlrpc php-zip | |
root@desktop:~# systemctl restart php7.2-fpm | |
root@desktop:~# nano /etc/nginx/sites-available/default | |
server { | |
# Add index.php to the list if you are using PHP | |
index index.php index.html index.htm index.nginx-debian.html; | |
location / { | |
# First attempt to serve request as file, then | |
# as directory, then fall back to displaying a 404. | |
# try_files $uri $uri/ =404; | |
try_files $uri $uri/ index.php$is_args$args; | |
} | |
# pass PHP scripts to FastCGI server | |
location ~ \.php$ { | |
include snippets/fastcgi-php.conf; | |
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; | |
} | |
# deny access to .htaccess files, if Apache's document root | |
# concurs with nginx's one | |
location ~ /\.ht { | |
deny all; | |
} | |
location = /favicon.ico { | |
log_not_found off; | |
access_log off; | |
} | |
location = /robots.txt { | |
log_not_found off; | |
access_log off; | |
allow all; | |
} | |
location ~* \.(css|ico|js|jpg|jpeg|gif|png|bmp|wav|flac|ogg|mp3|ttf|eot|svg|woff|otf)$ { | |
add_header Cache-Control public; | |
add_header Cache-Control must-revalidate; | |
expires max; | |
log_not_found on; | |
} | |
} | |
# save file and test changes | |
root@desktop:~# nginx -t | |
root@desktop:~# systemctl reload nginx | |
root@desktop:~# apt-get install phpmyadmin | |
press (y) | |
press (TAB) + (ENTER) | |
press (ENTER) | |
press (PASSWORD) | |
root@desktop:~# ln -s /usr/share/phpmyadmin /var/www/html | |
root@desktop:~# phpenmod mcrypt | |
root@desktop:~# systemctl restart php7.2-fpm | |
root@desktop:~# chown -R www-data:www-data /var/www/html | |
root@desktop:~# add-apt-repository ppa:certbot/certbot | |
root@desktop:~# apt install python-certbot-nginx | |
root@desktop:~# certbot --nginx -d domain.com -d www.domain.com | |
root@desktop:~# certbot renew --dry-run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment