Task #8923
Task #27561: Complete documentation
Provide a Nginx Server Configuration for FLOW3
| Status: | Under Review | Start date: | 2010-07-18 | |
|---|---|---|---|---|
| Priority: | Could have | Due date: | ||
| Assigned To: | Christian Müller | % Done: | 0% |
|
| Category: | - Documentation - | |||
| Target version: | TYPO3 Flow Base Distribution - 1.1.1 | |||
| Sprint: | Has patch: | No | ||
| PHP Version: | Complexity: |
Description
Provide or let the FLOW3 CLI generate a Nginx (or Apache) server configuration file or document it how one can use FLOW3 with nginx.
This is the main FLOW3 server configuration. On my blog i have posted the other configuration files needed: http://fritzthomas.com/php/600-how-to-use-flow3-with-nginx-working-server-configuration/
The only part i could not test are the "_Resources/Persistent" Urls. But they should work.
server {
listen 80;
server_name flow3.local *.flow3.local;
root /var/www/test/flow3/Web;
autoindex off;
access_log /var/www/test/logs/access.log combined;
error_log /var/www/test/logs/error.log info;
location ~ "^/_Resources/Persistent/" {
rewrite "^(_Resources/Persistent/.{40})/.+(\..+)" /$1$2 break;
}
location ~ "^/_Resources/" {
access_log off;
log_not_found off;
expires max;
break;
}
location / {
rewrite ".*" /index.php last;
}
location = /index.php {
#fastcgi_param FLOW3_CONTEXT Development;
fastcgi_param FLOW3_CONTEXT Production;
fastcgi_param FLOW3_REWRITEURLS 1;
fastcgi_intercept_errors on;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include includes/fastcgi_params;
# "Upstream" defined in nginx.conf
fastcgi_pass php-5.3.2;
}
}
Related issues
History
#1 Updated by Thomas Fritz about 5 years ago
It should read above: "The only part i could not test are the "_Resources/Persistent" Urls. But they should work." :)
#2 Updated by Karsten Dambekalns almost 5 years ago
- Category set to - Documentation -
#3 Updated by Oliver Wand over 4 years ago
Since I switched to Nginx on my Mac I wanted to adapt nginx.conf for FLOW3 (1.0.0-alpha14) to my needs.
The above blog bost didn't work for my configuration based on Nginx 0.8.54 (Macport installation) with PHP 5.3.5 on Mac OS 10.6.6.
What finally got me up and running - in addition to the above posting - was this forum entry: http://forum.nginx.org/read.php?2,866,30886
So here's the flow3.conf I included to my nginx.conf:
server {
listen 80;
server_name flow3.local *.flow3.local;
root /usr/local/html/FLOW3/Web;
autoindex off;
access_log /usr/local/var/log/nginx/access.log combined;
error_log /usr/local/var/log/nginx/error.log info;
location ~ "^/_Resources/Persistent/" {
rewrite "^(_Resources/Persistent/.{40})/.+(\..+)" /$1$2 break;
}
location ~ "^/_Resources/" {
access_log off;
log_not_found off;
expires max;
break;
}
location / {
rewrite ".*" /index.php last;
}
location ~ ^(.+\.php)(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param FLOW3_CONTEXT Development;
fastcgi_param FLOW3_REWRITEURLS 0;
fastcgi_intercept_errors on;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME /usr/local/html/FLOW3/Web$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include /usr/local/etc/nginx/fastcgi_params;
}
}
#4 Updated by Karsten Dambekalns about 4 years ago
- Parent task set to #27561
#5 Updated by Karsten Dambekalns about 4 years ago
- Status changed from New to Accepted
- Assigned To set to Karsten Dambekalns
- Target version set to 1230
#6 Updated by Karsten Dambekalns almost 4 years ago
- Subject changed from Provide a Nginx Server Configuration for flow3 to Provide a Nginx Server Configuration for FLOW3
#7 Updated by Karsten Dambekalns almost 4 years ago
- Tracker changed from Feature to Task
#8 Updated by Karsten Dambekalns almost 4 years ago
- Target version deleted (
1230)
#9 Updated by Martin Brüggemann over 3 years ago
- Has patch set to No
I had to modify the resource url regexp like this to get it working:
location ~ "^/_Resources/Persistent/" {
rewrite "(.{40})/.+(\..+)" /_Resources/Persistent/$1$2 break;
}
#10 Updated by Bastian Waidelich about 3 years ago
This is what we use for http://t3con12-asia.typo3.org/ right now for persistent resources (thanks to Steffen Gebert):
location ~ "^/_Resources/Persistent/" {
access_log off;
log_not_found off;
expires max;
rewrite "(.{40})/.+\.(.+)" /_Resources/Persistent/$1.$2 break;
rewrite "([a-z0-9]+/(.+/)?[a-f0-9]{40})/.+\.(.+)" /_Resources/Persistent/$1.$2 break;
}
#11 Updated by Karsten Dambekalns about 3 years ago
- Assigned To changed from Karsten Dambekalns to Christian Müller
#12 Updated by Karsten Dambekalns about 3 years ago
- Target version set to 1.1
#13 Updated by Karsten Dambekalns almost 3 years ago
- Target version changed from 1.1 to 1.1.1
#14 Updated by Christian Müller almost 3 years ago
Just as addition, I will compile all the info here into something final for docs. This is the rewrite config used in the conference websites:
location ~ "^/_Resources/Persistent/" {
access_log off;
log_not_found off;
expires max;
rewrite "(.{40})/.+\.(.+)" /_Resources/Persistent/$1.$2 break;
rewrite "([a-z0-9]+/(.+/)?[a-f0-9]{40})/.+\.(.+)" /_Resources/Persistent/$1.$2 break;
}
#15 Updated by Christian Müller almost 3 years ago
If you are working with master take care that the settings are now called FLOW_XXXXX instead of FLOW3_XXXXX
#16 Updated by Rafael Kähm almost 3 years ago
If you want to run some PHP-Applications like www.your-domain.dev/roundcubemail/, you must stop rewriting by existing files in TYPO3-Flow/Web(also document root).
here is my setup for TYPO3-Flow 1.1.0 and/or TYPO3-Neos Alapha1
server {
listen *:80;
server_name www.your-domain.dev ;
root /var/www/TYPO3-Flow/Web;
index index.html index.htm index.php index.xhtml;
error_log /var/log/httpd/www.your-domain.dev/error.log;
access_log /var/log/httpd/www.your-domain.dev/access.log combined;
## Disable .htaccess and other hidden files
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location /_Resources/ {
access_log off;
log_not_found off;
expires max;
break;
}
location /_Resources/Persistent/ {
access_log off;
log_not_found off;
expires max;
rewrite "(.{40})/.+\.(.+)" /_Resources/Persistent/$1.$2 break;
rewrite "([a-z0-9]+/(.+/)?[a-f0-9]{40})/.+\.(.+)" /_Resources/Persistent/$1.$2 break;
}
###
# stop rewriting by existing files | is instead of -> location / { rewrite ".*" /index.php last; }
# use this if you want to run other PHP-Applications in TYPO3-Flow/Web directory
###
try_files $uri $uri/ /index.php?$args;
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9012;
fastcgi_index index.php;
###
# for FLOW3 <= 1.1.x only | see note #15 on http://forge.typo3.org/issues/8923
###
fastcgi_param FLOW3_CONTEXT Development;
# fastcgi_param FLOW3_CONTEXT Production;
fastcgi_param FLOW3_REWRITEURLS 1;
###
# Make sure that you set the environment vars for new versions \
# of TYPO3-XXXXX(TYPO3-Neos) products properly
# see note #15 on http://forge.typo3.org/issues/8923
###
# fastcgi_param FLOW_CONTEXT Development;
## fastcgi_param FLOW_CONTEXT Production;
# fastcgi_param FLOW_REWRITEURLS 1;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
fastcgi_read_timeout 240; ### set this value for your server
}
}
#17 Updated by Karsten Dambekalns over 2 years ago
- Target version changed from 1.1.1 to 2052
#18 Updated by Karsten Dambekalns almost 2 years ago
- Target version changed from 2052 to 1.1.1
#19 Updated by Simon Schaufelberger over 1 year ago
any update here? what's blocking to put that in the repository?
#20 Updated by Michiel Roos over 1 year ago
Bump!
#21 Updated by Gerrit Code Review about 1 year ago
- Status changed from Accepted to Under Review
Patch set 1 for branch master of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at https://review.typo3.org/30398