Skip to main content

Sadržaj

nano /etc/nginx/sites-enabled/default

server { # Ports to listen on, uncomment one. listen 443 ssl http2; listen [::]:443 ssl http2;

# Server name to listen for
server_name spaceit.io;

# Path to document root
root /var/www/spaceit.io;

# Paths to certificate files.
# ssl_certificate /etc/letsencrypt/live/ssl.com/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/ssl.com/privkey.pem;

# Don't use outdated SSLv3 protocol. Protects against BEAST and POODLE attacks.
#ssl_protocols TLSv1.2 TLSv1.3;

# Use secure ciphers
#ssl_ciphers EECDH+CHACHA20:EECDH+AES;
#ssl_ecdh_curve X25519:prime256v1:secp521r1:secp384r1;
#ssl_prefer_server_ciphers on;

# Define the size of the SSL session cache in MBs.
#ssl_session_cache shared:SSL:1m;

# Define the time in minutes to cache SSL sessions.
#ssl_session_timeout 24h;

# Tell browsers the site should only be accessed via https.
# add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;

# File to be used as index
index index.php index.html;

# Overrides logs defined in nginx.conf, allows per site logs.
# access_log /sites/ssl.com/logs/access.log;
# error_log /sites/ssl.com/logs/error.log;

# Default server block rules
# include global/server/defaults.conf;

# SSL rules - ssl_certificate, etc
# include global/server/ssl.conf;

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

location ~ \.php$ {
    try_files $uri =404;
	include snippets/fastcgi-php.conf;
	fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;

}

# Rewrite robots.txt
rewrite ^/robots.txt$ /index.php last;

}

Redirect http to https

server { listen 80; listen [::]:80; server_name spaceit.io www.spaceit.io;

return 301 https://spaceit.io$request_uri;

}

Redirect www to non-www

server { listen 443; listen [::]:443; server_name www.ssl.com;

return 301 https://spaceit.io$request_uri;

}