Потрібно налаштувати nginx
Сайт: написаний на вордпрес.
Сервер: nginx
Операційна система: Debian 11
Задача:
Є сайт. Він відкривається зі слешем в кінці і без слеша. Треба щоб завжди був слеш.
Ось сам конфіг:
server
{
listen 80;
listen 443 ssl http2;
server_name www.example.com.ua example.com.ua;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/example.com.ua;
# BEGIN Converter for Media
set $ext_avif ".avif";
if ($http_accept !~* "image/avif") {
set $ext_avif "";
}
set $ext_webp ".webp";
if ($http_accept !~* "image/webp") {
set $ext_webp "";
}
location ~ /wp-content/(?<path>.+)\.(?<ext>jpe?g|png|gif|webp)$ { expires 365d;
try_files
/wp-content/uploads-webpc/$path.$ext$ext_avif
/wp-content/uploads-webpc/$path.$ext$ext_webp
$uri =404;
}
# END Converter for Media
# note: the use of "^[^?]*?" avoids matches in querystring portion which would cause an infinite redirect loop
if ($request_uri ~ "^[^?]*?//") {
rewrite "^" $scheme://$host$uri permanent;
}
if ($host ~ /^www\./) {
rewrite ^(/.*)$ https://$host$1 permanent;
}
#location ~ [A-Z] {
# rewrite ^(.*)$ $scheme://$http_host$uri$is_args$args permanent;
#}
#SSL-START SSL related configuration, do NOT delete or modify the next line of commented-out 404 rules
#error_page 404/404.html;
ssl_certificate /www/server/panel/vhost/cert/example.com.ua/fullchain.pem;
ssl_certificate_key /www/server/panel/vhost/cert/example.com.ua/privkey.pem;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
add_header Strict-Transport-Security "max-age=31536000";
error_page 497 https://$host$request_uri;
#SSL-END
#ERROR-PAGE-START Error page configuration, allowed to be commented, deleted or modified
#error_page 404 /404.html;
#error_page 502 /502.html;
#ERROR-PAGE-END
#PHP-INFO-START PHP reference configuration, allowed to be commented, deleted or modified
include enable-php-74.conf;
#PHP-INFO-END
#REWRITE-START URL rewrite rule reference, any modification will invalidate the rewrite rules set by the panel
include /www/server/panel/vhost/rewrite/dev.example.com.ua.conf;
#REWRITE-END
# Forbidden files or directories
location ~ ^/(\.user.ini|\.htaccess|\.git|\.env|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
# Directory verification related settings for one-click application for SSL certificate
location ~ \.well-known{
allow all;
}
#Prohibit putting sensitive files in certificate verification directory
if ( $uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$" ) {
return 403;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|svg)$
{
expires 30d;
error_log /dev/null;
access_log off;
}
location ~ .*\.(js|css)?$
{
expires 12h;
error_log /dev/null;
access_log off;
}
access_log /www/wwwlogs/example.com.ua.log;
error_log /www/wwwlogs/example.com.ua.error.log;
}
-
Vitalii Holomidov Yota-X
Здається це мало б помогти
Замініть root /www/wwwroot/example.com.ua; на root /www/wwwroot/example.com.ua/;
Дайте знати чи получилось -
Current freelance projects in the category System & Network Administration
IP Telephony SetupThe task is to set up a virtual PBX on Zadarma with 2 virtual numbers and connect physical IP phones to it (3 devices in two different locations) Enterprise Resource Planning (ERP), System & Network Administration ∙ 3 days 21 hours ago ∙ 4 proposals |
Asterisk
60 USD
It is necessary to understand the already established Asterisk. The already configured softphones have lost the ability to connect, whereas yesterday such a possibility existed, and the ports are open in the network. Linux & Unix, System & Network Administration ∙ 5 days 13 hours ago ∙ 7 proposals |
Help needed with restoring the Facebook group.Good day! I am looking for an IT specialist who has experience working with social networks, particularly Facebook. The situation is as follows: my military friend was an administrator of a Facebook group, but he was illegally removed by other people (probably due to… System & Network Administration ∙ 5 days 15 hours ago ∙ 1 proposal |
Asterisk / Linux
144 USD
Candidate Requirements: Good knowledge of ASTERISK Ability to work with LINUX [UBUNTU 24 server] I need to deploy Asterisk on my server and attach modules to it. Before starting work, I am attaching an article. Payment for the task is up to 150 USD. Depending on the volume of… Linux & Unix, System & Network Administration ∙ 6 days 16 hours ago ∙ 6 proposals |
It is necessary to set up geotargeting for banner displays in Google Ad Manager.Our website has a fairly complex structure (26 languages, 88 subdomains (countries), 100 markets (product categories). The account in Google Ad Manager is already set up, but it incorrectly handles geotargeting (by user IP) It is necessary to generate the correct codes and… System & Network Administration, Banners ∙ 7 days 18 hours ago ∙ 2 proposals |