if ($http_referer ~* "^https?://(site1\.ru|site2\.com|site3\.org)") {
return 403;
}
valid_referers ~^(?!site1\.ru|site2\.com|site3\.org);
if ($invalid_referer) {
return 403;
}
rewrite ^/test$ /test.php;
location / {
try_files $uri @php;
}
location @php {
try_files $uri.php =404;
fastcgi_pass ... ;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
RewriteCond %{REQUEST_URI} ^/auxpage_.+/.+$
RewriteRule ^ - [R=404,L]
RewriteRule ^auxpage_.+/.+ - [R=404,L]
php.mysite.ru/phpmyadmin
было php.mysite.ru/
нужно исправить root путь.server {
listen 80;
listen [::]:80;
root /var/www/html/phpmyadmin;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name php.mysite.ru
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
}
import re
txt = '''
26. Эта замечательная жизнь (It’s a Wonderful Life) (1946)
Мысли о самоубийстве одолевают в определенные периоды жизни любого че...
27. Однажды на Диком Западе (C’era una volta il West) (1968)
Об этом вестерне Серджио Леоне можно писать долго. Режиссер в очередной раз
'''
m = re.findall(r'(?m)^\d+\.\s*(.*)', txt)
print(m)
сайт.ру/q?example=1 было сайт.ру/q/example/1
RewriteCond %{QUERY_STRING} (?:^|&)(example)=(1)(?:$|&)
RewriteRule ^q$ https://site.ru/q/%1/%2? [R=301,L]
https://site.ru
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name site.ru;
ssl_certificate ... ;
ssl_certificate_key ... ;
}
Если у совпавшего префиксного location’а максимальной длины указан модификатор “^~”, то регулярные выражения не проверяются.
location /site2/
добавить ^~
location /site1 {
добавить location ~* \.php$
location /site1 {
root /var/www/site1;
location ~* \.php$ {
try_files $uri = 404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock; # подключаем сокет php-fpm
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
location ^~ /site2/ {
proxy_pass https://site2/;
}
RewriteCond %{DOCUMENT_ROOT}/files/$1 -f
RewriteRule ^(img/.+) /files/$1 [L]
server_name domain.ru;
location /api/ {
root /var/www/site.ru;
rewrite ^ /index.php break;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
}
server {
client_max_body_size 32M;
location /faq/upload {
client_max_body_size 400M;
try_files $uri @admin_upload;
}
location @admin_upload {
rewrite ^ /index.php break;
fastcgi_pass ... ;
include fastcgi_params;
}
location ~ \.php$ {
fastcgi_pass ... ;
include fastcgi_params;
}
server
{
...
location ~* ^/build/.*\.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
expires max;
log_not_found off;
}
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
log_not_found off;
}
}