Mudanças entre as edições de "Instalação NGINX + Wordpress Ubuntu 22.04"

De Gigafull
Ir para navegação Ir para pesquisar
 
(6 revisões intermediárias pelo mesmo usuário não estão sendo mostradas)
Linha 1: Linha 1:
 
Ubuntu Server 22.04<br><br>
 
Ubuntu Server 22.04<br><br>
  
apt install net-tools -y<br><br>
+
apt install net-tools -y
 +
apt install nmap -y
 +
apt install apache2 -y
 +
apt install mysql-server -y
 +
apt install php libapache2-mod-php php-mysql php-curl php-gd php-json php-zip -y
  
sudo apt update -y<br>
+
sudo apt update -y
sudo apt upgrade -y<br><br>
+
sudo apt upgrade -y
  
sudo apt install nginx -y<br>
+
sudo systemctl restart apache2
sudo systemctl status nginx<br><br>
 
  
sudo apt install mysql-server -y<br>
+
sudo mysql -u root -p
sudo systemctl status mysql<br><br>
+
CREATE DATABASE wordpress;
 +
CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'grtewUBINOP89UBio';
 +
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';
 +
FLUSH PRIVILEGES;
 +
exit;
  
mysql -u root -p<br>
+
mkdir /var/www/wiki
CREATE DATABASE WordPress CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;<br>
 
CREATE USER 'WordPressUser'@'localhost' IDENTIFIED BY 'UYBR438DE98I3MD43M430IDV34';<br>
 
GRANT ALL PRIVILEGES ON WordPress .* TO 'WordPressUser'@'localhost';<br>
 
FLUSH PRIVILEGES;<br>
 
EXIT;<br><br>
 
  
sudo apt install php -y<br><br>
+
vim /etc/apache2/sites-available/wiki.gigafull.com.br.conf
 +
<VirtualHost *:80>
 +
    ServerName wiki.gigafull.com.br
 +
    DocumentRoot /var/www/wiki
 +
    <Directory /var/www/wiki>
 +
        Options Indexes FollowSymLinks MultiViews
 +
        AllowOverride All
 +
        Require all granted
 +
    </Directory>
 +
    ErrorLog ${APACHE_LOG_DIR}/wiki_error.log
 +
    CustomLog ${APACHE_LOG_DIR}/wiki_access.log combined
 +
</VirtualHost>
  
sudo mkdir -p /var/www/html/sample.com<br>
+
a2ensite wiki.gigafull.com.br.conf
cd /tmp<br>
+
systemctl reload apache2
wget https://wordpress.org/latest.tar.gz<br>
 
tar xf latest.tar.gz<br>
 
sudo mv /tmp/wordpress/* /var/www/html/sample.com/<br>
 
sudo chown -R www-data: /var/www/html/sample.com<br><br>
 
  
vim /etc/nginx/sites-available/sample.com
+
vim /etc/hosts
  Add this code to the newly created file:
+
127.0.0.1 wiki.gigafull.com.br
 +
  ::1 wiki.gigafull.com.br
  
  # Redirect HTTP -> HTTPS
+
  cd /tmp
  server {
+
  curl -O https://wordpress.org/latest.tar.gz
listen 80;
+
  tar xzvf latest.tar.gz -C /var/www/wiki --strip-components=1
  server_name www.sample.com sample.com;
 
  
  include snippets/letsencrypt.conf;
+
  Acessa o WP pelo endereço wiki.gigafull.com.br/wp-admin
  return 301 https://sample.com$request_uri;
+
  Faça o setup de instalação, copie o código gerado e insira no arquivo /var/www/wiki/wp-config.php
}
 
  
  # Redirect WWW -> NON-WWW
+
  De seguimento ao setup de instalação.
server {
 
listen 443 ssl http2;
 
server_name www.sample.com;
 
  
  ssl_certificate /etc/letsencrypt/live/sample.com/fullchain.pem;
+
  Senha WP: UA)!dgMfCNnlXhE%75
ssl_certificate_key /etc/letsencrypt/live/sample.com/privkey.pem;
 
ssl_trusted_certificate /etc/letsencrypt/live/sample.com/chain.pem;
 
include snippets/ssl.conf;
 
 
 
return 301 https://sample.com$request_uri;
 
}
 
 
 
server {
 
listen 443 ssl http2;
 
server_name sample.com;
 
 
 
root /var/www/html/sample.com;
 
index index.php;
 
 
 
# SSL parameters
 
ssl_certificate /etc/letsencrypt/live/sample.com/fullchain.pem;
 
ssl_certificate_key /etc/letsencrypt/live/sample.com/privkey.pem;
 
ssl_trusted_certificate /etc/letsencrypt/live/sample.com/chain.pem;
 
include snippets/ssl.conf;
 
include snippets/letsencrypt.conf;
 
 
 
# log files
 
access_log /var/log/nginx/sample.com.access.log;
 
error_log /var/log/nginx/sample.com.error.log;
 
 
 
location = /favicon.ico {
 
log_not_found off;
 
access_log off;
 
}
 
 
 
location = /robots.txt {
 
allow all;
 
log_not_found off;
 
access_log off;
 
}
 
 
 
location / {
 
try_files $uri $uri/ /index.php?$args;
 
}
 
 
 
location ~ \.php$ {
 
include snippets/fastcgi-php.conf;
 
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
 
}
 
 
 
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
 
expires max;
 
log_not_found off;
 
}
 
}
 

Edição atual tal como às 09h14min de 12 de abril de 2023

Ubuntu Server 22.04

apt install net-tools -y
apt install nmap -y
apt install apache2 -y
apt install mysql-server -y
apt install php libapache2-mod-php php-mysql php-curl php-gd php-json php-zip -y
sudo apt update -y
sudo apt upgrade -y
sudo systemctl restart apache2
sudo mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'grtewUBINOP89UBio';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';
FLUSH PRIVILEGES;
exit;
mkdir /var/www/wiki

vim /etc/apache2/sites-available/wiki.gigafull.com.br.conf

<VirtualHost *:80>
   ServerName wiki.gigafull.com.br
   DocumentRoot /var/www/wiki
   <Directory /var/www/wiki>
       Options Indexes FollowSymLinks MultiViews
       AllowOverride All
       Require all granted
   </Directory>
   ErrorLog ${APACHE_LOG_DIR}/wiki_error.log
   CustomLog ${APACHE_LOG_DIR}/wiki_access.log combined
</VirtualHost>
a2ensite wiki.gigafull.com.br.conf
systemctl reload apache2
vim /etc/hosts
127.0.0.1 wiki.gigafull.com.br
::1 wiki.gigafull.com.br
cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz -C /var/www/wiki --strip-components=1
Acessa o WP pelo endereço wiki.gigafull.com.br/wp-admin
Faça o setup de instalação, copie o código gerado e insira no arquivo /var/www/wiki/wp-config.php
De seguimento ao setup de instalação.
Senha WP: UA)!dgMfCNnlXhE%75