Advertisement
daredevil001

nginx.conf

Dec 12th, 2021
1,283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # ./nginx.conf
  2. server {
  3.         listen 80;
  4.         listen [::]:80;
  5.  
  6.         # такая конструкция позволяет обращаться по любому доменному имени
  7.         server_name _;
  8.  
  9.         index index.php index.html index.htm;
  10.  
  11.         # корневая директория нашего сайта. Взаимосвязь - ищи в Dockerfile
  12.         root /var/www/html/wordpress;
  13.  
  14.         location ~ /.well-known/acme-challenge {
  15.                 allow all;
  16.                 root /var/www/html;
  17.         }
  18.  
  19.         location / {
  20.                 try_files $uri $uri/ /index.php$is_args$args;
  21.         }
  22.  
  23.         # fastcgi_pass php:9000; - for php image
  24.        # fastcgi_pass wordpress:9000; - for wordpress image
  25.         location ~ \.php$ {
  26.                 try_files $uri =404;
  27.                 fastcgi_split_path_info ^(.+\.php)(/.+)$;
  28.                 fastcgi_pass php:9000;
  29.                 fastcgi_index index.php;
  30.                 include fastcgi_params;
  31.                 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  32.                 fastcgi_param PATH_INFO $fastcgi_path_info;
  33.         }
  34.  
  35.         location ~ /\.ht {
  36.                 deny all;
  37.         }
  38.  
  39.         location = /favicon.ico {
  40.                 log_not_found off; access_log off;
  41.         }
  42.         location = /robots.txt {
  43.                 log_not_found off; access_log off; allow all;
  44.         }
  45.         location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
  46.                 expires max;
  47.                 log_not_found off;
  48.         }
  49. }
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement