Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > HOWTO-Related Questions

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 29th April 2012, 14:03
artworkad artworkad is offline
Junior Member
 
Join Date: Apr 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Running TYPO3 4.6.x On Nginx (LEMP) On Debian Squeeze

Hi,

I have a question regarding this tutorial http://www.howtoforge.com/running-ty...e-ubuntu-11.10

First, it is a great tutorial and it helped me to get Typo3 running with nginx. But now I want to serve my typo3 project not from a 'global' domain or subdomain but from a sub folder like www.example.com/partner.

I have two nginx servers. The first server gets a request www.example.com/partner and sends it 1:1 to nginx server two (where my typo3 project is located under /var/www/example), this is from the access log of server two

Quote:
"GET /partner/ HTTP/1.0" 200 2845
To accomplish this I changed try files and added fastcgi_split_path_info like described here: http://wiki.nginx.org/WordPress#Non-...o_URL_redirect but I keep getting 403 Forbidden.

Here is the entire config: http://dpaste.com/739744/

Any ideas whats wrong?

I did
chown -R www-data:www-data /var/www/www.example.com/web
so this should not be the problem.
Reply With Quote
Sponsored Links
  #2  
Old 30th April 2012, 11:42
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,747 Times in 2,578 Posts
Default

Try this instead:

Code:
server {
       listen ip:80;
       server_name www.example.com example.com;
       root /var/www/luckygaming;

       if ($http_host != "www.lucky-betting.com") {
                 rewrite ^ https://www.example.com$request_uri permanent;
       }

       index index.php index.html;

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

       location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
       }

       # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
       location ~ /\. {
                deny all;
                access_log off;
                log_not_found off;
       }

       location ~*  \.(jpg|jpeg|png|gif|css|js|ico)$ {
                expires max;
                log_not_found off;
       }
       location ~* \.(cur|ico|gif|png|jpe?g|css|js|swf|woff)((\?\d\d\d\d\d\d\d\d\d\d)|(\?s=\d\d\d\d\d\d\d\d\d\d))$ {
                expires max;
                log_not_found off;
       }
       location ~* \.(cur|ico|gif|png|jpe?g|css|js|swf|woff)(\?v\d\d?\.\d\d?\.\d\d?)$ {
                expires max;
                log_not_found off;
       }
       location ~* ^(/partner/typo3/sysext|/partner/typo3conf/ext).*\.(cur|ico|gif|png|jpe?g|css|js|swf|woff) {
                expires max;
                log_not_found off;
       }
       location = /clear.gif {
                empty_gif;
                expires max;
       }
       location ^~ /partner/typo3/gfx {
                expires max;
       }
       location ^~ /partner/typo3temp/compressor {
                expires max;
       }
       location ~* \.(sql|htaccess|htpasswd|tpl|html5|xhtml) {
                deny all;
       }

       location /partner {
                if ($query_string ~ ".+") {
          return 405;
                }
                # pass requests from logged-in users to PHP
                if ($http_cookie = 'nc_staticfilecache|be_typo_user' ) {
                        return 405;
                } # pass POST requests to PHP
                if ($request_method !~ ^(GET|HEAD)$ ) {
                        return 405;
                }
                if ($http_pragma = 'no-cache') {
                        return 405;
                }
                if ($http_cache_control = 'no-cache') {
                        return 405;
                }
                error_page 405 = @nocache;

                # serve requested content from the cache if available, otherwise pass the request to PHP
                try_files /partner/typo3temp/tx_ncstaticfilecache/$host${request_uri}index.html @nocache;
       }

       location @nocache {
                try_files $uri $uri/ /partner/index.php?$args;
       }

       location ^~ /partner/typo3temp/tx_ncstaticfilecache {
                expires 43200;
                charset utf-8;
       }

       location ~ \.php$ {
                include  fastcgi_params;
                try_files $uri =403;
                fastcgi_split_path_info ^(/partner)(/.*)$;
               # include  fastcgi_params;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                fastcgi_index index.php;
       }
}
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 30th April 2012, 11:48
artworkad artworkad is offline
Junior Member
 
Join Date: Apr 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for reply. but I get still the 403 error
Reply With Quote
  #4  
Old 1st May 2012, 11:40
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,747 Times in 2,578 Posts
Default

If you change

Code:
location ~ \.php$ {
                include  fastcgi_params;
                try_files $uri =403;
                fastcgi_split_path_info ^(/partner)(/.*)$;
               # include  fastcgi_params;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                fastcgi_index index.php;
       }
to
Code:
location ~ \.php$ {
                include  fastcgi_params;
                try_files $uri =404;
                fastcgi_split_path_info ^(/partner)(/.*)$;
               # include  fastcgi_params;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                fastcgi_index index.php;
       }
do you get a 404 then?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #5  
Old 1st May 2012, 12:00
artworkad artworkad is offline
Junior Member
 
Join Date: Apr 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It works now with this config. Actually it seems to be the same config. I just worked on it a bit and suddenly it worked.


Code:
server {
        listen  ip:80; ## listen for ipv4

        server_name  www.example.com;

     if ($http_host != "www.example.com") {
                 rewrite ^ https://www.example.com$request_uri permanent;
       }
                root   /var/www/example;
    location = /robots.txt {
                allow all;
                log_not_found off;
                access_log off;
       }

       # Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
       location ~ /\. {
                deny all;
                access_log off;
                log_not_found off;
       }

       location ~*  \.(jpg|jpeg|png|gif|css|js|ico)$ {
                expires max;
                log_not_found off;
       }
       location ~* \.(cur|ico|gif|png|jpe?g|css|js|swf|woff)((\?\d\d\d\d\d\d\d\d\d\d)|(\?s=\d\d\d\d\d\d\d\d\d\d))$ {
                expires max;
                log_not_found off;
       }
       location ~* \.(cur|ico|gif|png|jpe?g|css|js|swf|woff)(\?v\d\d?\.\d\d?\.\d\d?)$ {
                expires max;
                log_not_found off;
       }
       location ~* ^(/partner/typo3/sysext|/typo3conf/ext).*\.(cur|ico|gif|png|jpe?g|css|js|swf|woff) {
                expires max;
                log_not_found off;
       }
       location = /clear.gif {
                empty_gif;
                expires max;
       }
       location ^~ /partner/typo3/gfx {
                expires max;
       }

  location ^~ /partner/typo3temp/compressor {
                expires max;
       }
       location ~* \.(sql|htaccess|htpasswd|tpl|html5|xhtml) {
                deny all;
       }

       location /partner {
                if ($query_string ~ ".+") {
                        return 405;
                }
                # pass requests from logged-in users to PHP
                if ($http_cookie = 'nc_staticfilecache|be_typo_user' ) {
                        return 405;
                } # pass POST requests to PHP
                if ($request_method !~ ^(GET|HEAD)$ ) {
                        return 405;
                }
                if ($http_pragma = 'no-cache') {
                        return 405;
                }
                if ($http_cache_control = 'no-cache') {
                        return 405;
                }
                error_page 405 = @nocache;

                # serve requested content from the cache if available, otherwise pass the request to PHP
                try_files /partner/typo3temp/tx_ncstaticfilecache/$host${request_uri}index.html @nocache;
       }

       location @nocache {
                try_files $uri $uri/ /partner/index.php?$args;
       }

       location ^~ /partner/typo3temp/tx_ncstaticfilecache {
                expires 43200;
                charset utf-8;
       }

        index  index.php index.html index.htm;

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
                try_files $uri =403;
                include  fastcgi_params;
                fastcgi_split_path_info ^(/partner)(/.*)$;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include         fastcgi_params;
        }

}
I placed a info.php file in /partner and it displays correctly. However typo3 does not work correctly.

When I go to the backend https://www.example.com/partner/backend.php it redirects me to https://www.example.com/backend.php. And firebug shows stuff like

Quote:
The page at https://www.example.com/partner/typo...p_aboutmodules displayed insecure content from http://www.example.com/install/.
/install/:1GET https://www.example.com/install/ 404 (NOT FOUND)
any idea how to fix this?

Last edited by artworkad; 1st May 2012 at 12:43.
Reply With Quote
  #6  
Old 2nd May 2012, 12:24
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,747 Times in 2,578 Posts
Default

Can you change
Code:
       location @nocache {
                try_files $uri $uri/ /partner/index.php?$args;
       }
to
Code:
       location @nocache {
                try_files /partner$uri /partner$uri/ /partner/index.php?$args;
       }
and try again?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #7  
Old 2nd May 2012, 12:32
artworkad artworkad is offline
Junior Member
 
Join Date: Apr 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default

Changed, reloaded nginx, same problem. when I go to example.com/partner/typo3/index.php it redirects me to example.com/backend.php

when I open example.com/partner it redirects me to example.com/home but it should be example.com/partner/home
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
High on Lenny - Lvm Mount Problem Serverman Technical 1 23rd June 2009 17:26
Move /var to new drive on Debian Etch running ISPConfig McMadd Installation/Configuration 1 12th January 2008 18:14
Please help me whit bind9 astra2000 Server Operation 12 10th October 2007 03:43
Bind Failed christoph2k HOWTO-Related Questions 4 28th April 2007 01:57
e-mail problem!!! Debian 3.1 maroonworks Installation/Configuration 18 6th December 2005 15:42


All times are GMT +2. The time now is 06:39.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.