Advertisement
kabads

Untitled

Feb 4th, 2021
2,528
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 3.77 KB | None | 0 0
  1. ##
  2. # You should look at the following URL's in order to grasp a solid understanding
  3. # of Nginx configuration files in order to fully unleash the power of Nginx.
  4. # https://www.nginx.com/resources/wiki/start/
  5. # https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
  6. # https://wiki.debian.org/Nginx/DirectoryStructure
  7. #
  8. # In most cases, administrators will remove this file from sites-enabled/ and
  9. # leave it as reference inside of sites-available where it will continue to be
  10. # updated by the nginx packaging team.
  11. #
  12. # This file will automatically load configuration files provided by other
  13. # applications, such as Drupal or Wordpress. These applications will be made
  14. # available underneath a path with that package name, such as /drupal8.
  15. #
  16. # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
  17. ##
  18.  
  19. # Default server configuration
  20. #
  21.  
  22. #server {
  23. #   listen 80;
  24. #   server_name my.domain.com;
  25. #   location / {
  26. #       root /var/www/html;
  27. #   }
  28. #}
  29.  
  30. server {
  31.         listen 80 default_server;
  32.     listen [::]:80 default_server;
  33.     server_name my.domain.com;
  34.     # SSL configuration
  35.     #
  36.     listen 443 ssl default_server;
  37.     # listen [::]:443 ssl default_server;
  38.     #
  39.     # Note: You should disable gzip for SSL traffic.
  40.     # See: https://bugs.debian.org/773332
  41.     #
  42.     # Read up on ssl_ciphers to ensure a secure configuration.
  43.     # See: https://bugs.debian.org/765782
  44.     #
  45.     # Self signed certs generated by the ssl-cert package
  46.     # Don't use them in a production server!
  47.     #
  48.     # include snippets/snakeoil.conf;
  49.  
  50.     root /var/www/html;
  51.  
  52.     # Add index.php to the list if you are using PHP
  53.     index index.html index.htm index.nginx-debian.html index.php;
  54.  
  55.     server_name my.domain.com;
  56.         ssl_certificate /etc/letsencrypt/live/my.domain.com/fullchain.pem;
  57.         ssl_certificate_key /etc/letsencrypt/live/my.domain.com/privkey.pem;
  58.         ## Begin - PHP
  59.         location ~ \.php$ {
  60.  
  61.         include snippets/fastcgi-php.conf;
  62.         # Choose either a socket or TCP/IP address
  63.         fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
  64.         # fastcgi_pass 127.0.0.1:9000;
  65.         #  
  66.         #      fastcgi_split_path_info ^(.+\.php)(/.+)$;
  67.         #      fastcgi_index index.php;
  68.         #      include fastcgi_params;
  69.         #      fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
  70.         }
  71.         ## End - PHP
  72.  
  73.     location /grocy  {
  74.            alias /var/www/grocy/public;
  75.            try_files $uri $uri/ @grocy;
  76.  
  77.             location ~ \.php$ {
  78.                 include snippets/fastcgi-php.conf;
  79.                 fastcgi_param SCRIPT_FILENAME $request_filename;
  80.                 fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
  81.             }
  82.         }
  83.  
  84.     location @grocy  {
  85.            rewrite /(.*)$ /grocy/index.php?/$1 last;
  86.         }
  87.  
  88.  
  89.     location / {
  90.         # First attempt to serve request as file, then
  91.         # as directory, then fall back to displaying a 404.
  92.         try_files $uri $uri/ =404 /index.php;
  93.         # try_files $uri /index.php$is_args$query_string;
  94.         # autoindex on;
  95.     }
  96.  
  97.     # pass PHP scripts to FastCGI server
  98.     #
  99.     location ~ \.php$ {
  100.         include snippets/fastcgi-php.conf;
  101.     #
  102.     #   # With php-fpm (or other unix sockets):
  103.         fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
  104.     #   # With php-cgi (or other tcp sockets):
  105.         #fastcgi_pass 127.0.0.1:9000;
  106.        
  107.     }
  108.  
  109.     # deny access to .htaccess files, if Apache's document root
  110.     # concurs with nginx's one
  111.     #
  112.     #location ~ /\.ht {
  113.     #   deny all;
  114.     #}
  115. }
  116.  
  117.  
  118. # Virtual Host configuration for example.com
  119. #
  120. # You can move that to a different file under sites-available/ and symlink that
  121. # to sites-enabled/ to enable it.
  122. #
  123. #server {
  124. #   listen 80;
  125. #   listen [::]:80;
  126. #
  127. #   server_name example.com;
  128. #
  129. #   root /var/www/example.com;
  130. #   index index.html;
  131. #
  132. #   location / {
  133. #       try_files $uri $uri/ =404;
  134. #   }
  135. #}
  136.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement