Project

General

Profile

Actions

Task #83704

closed

Add nginx server example

Added by Jan Kiesewetter almost 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2018-01-28
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

As there is a IIS example and a .htaccess for Apache, an example for nginx should exist.

I made a server config from the IIS example:

server {
    listen                80;
    server_name           ${VHOST};
    root                  /app/web;
    client_max_body_size  100M;
    index                 index.php index.html index.htm;

    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    # TYPO3 - Block access to composer files
    location ~* composer\.(?:json|lock) {
        deny all;
    }

    # TYPO3 - Block access to flexform files
    location ~* flexform[^.]*\.xml {
        deny all;
    }

    # TYPO3 - Block access to language files
    location ~* locallang[^.]*\.(?:xml|xlf)$ {
        deny all;
    }

    # TYPO3 - Block access to static typoscript files
    location ~* ext_conf_template\.txt|ext_typoscript_constants\.(?:txt|typoscript)|ext_typoscript_setup\.(?:txt|typoscript) {
        deny all;
    }

    # TYPO3 - Block access to miscellaneous protected files
    location ~* /.*\.(?:bak|co?nf|cfg|ya?ml|ts|typoscript|dist|fla|in[ci]|log|sh|sql)$ {
        deny all;
    }

    # TYPO3 - Block access to recycler and temporary directories
    location ~ _(?:recycler|temp)_/ {
        deny all;
    }

    # TYPO3 - Block access to configuration files stored in fileadmin
    location ~ fileadmin/(?:templates)/.*\.(?:txt|ts|typoscript)$ {
        deny all;
    }

    # TYPO3 - Block access to libaries, source and temporary compiled data
    location ~ ^(?:vendor|typo3_src|typo3temp/var) {
        deny all;
    }

    # TYPO3 - Block access to protected extension directories
    location ~ (?:typo3conf/ext|typo3/sysext|typo3/ext)/[^/]+/(?:Configuration|Resources/Private|Tests?|Documentation|docs?)/ {
        deny all;
    }

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

    location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
        if (!-f $document_root$fastcgi_script_name) {
            return 404;
        }
        fastcgi_read_timeout 240;
        fastcgi_pass         php-fpm:9000;
        fastcgi_index        index.php;
        include              fastcgi.conf;
    }
}


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Task #54316: Provide a Nginx server configurationClosed2013-12-11

Actions
Actions #1

Updated by Riccardo De Contardi almost 7 years ago

  • Related to Task #54316: Provide a Nginx server configuration added
Actions #2

Updated by Riccardo De Contardi almost 7 years ago

  • Status changed from New to Closed

Hi Jan , thank you for your work; I am closing your issue as it is a duplicate of #54316 ; please continue the discussion there. I've added there a reference to this issue and copied your configuration proposal to keep track of it.

Thank you.

Actions

Also available in: Atom PDF