Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

Multidomain Installation for CMS and NGINX

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
13 posts
  • Previous
  • 1
  • 2
web-seo-consulting
Posts: 35
Joined: Sat Jun 25, 2016 6:56 pm

Re: Multidomain Installation for CMS and NGINX
  • Quote

Post by web-seo-consulting » Mon Jun 27, 2016 8:20 pm

Ok ich war auf den richtigen Weg aber leider hat es dennoch nicht geklappt.

Habe neu installiert und nochmal alles gemacht:
/usr/local/vesta/data/templates/web/nginx/php5-fpm
die Datei default.php kopiert und umbenannt in contao.tpl das gleiche mit der *.stpl

folgende Zeilen anpassen

Code: Select all

root        %docroot%/web;
index       app.php index.php index.html index.htm;
fastcgi_index   app.php; 
nun läuft es soweit. Ich kann die Seite ohne /web aufrufen.

So nun die nächsten Fehler ausräumen :D
Top

web-seo-consulting
Posts: 35
Joined: Sat Jun 25, 2016 6:56 pm

Re: Multidomain Installation for CMS and NGINX
  • Quote

Post by web-seo-consulting » Wed Jun 29, 2016 10:11 am

So my try with the converters fails repeatedly.
Either I get tw the "website" to download or he follows it a 404th
Who can help me with the Rules?
Here is the .htaccess:
==================================
Also meine versuche mit den Konvertern scheitert immer wieder.
Entweder ich bekomme tw die "Webseite" zum download oder aber er es folgt ein 404.
Wer kann mir bei den Rules helfen?
Hier die htaccess:

Code: Select all

# to the front controller "/app.php" but be rewritten to "/app.php/app".
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Determine the RewriteBase automatically and set it as environment variable.
    # If you are using Apache aliases to do mass virtual hosting or installed the
    # project in a subdirectory, the base path will be prepended to allow proper
    # resolution of the app.php file and to redirect to the correct URI. It will
    # work in environments without path prefix as well, providing a safe, one-size
    # fits all solution. But as you do not need it in this case, you can comment
    # the following 2 lines to eliminate the overhead.
    RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
    RewriteRule ^(.*) - [E=BASE:%1]

    # Sets the HTTP_AUTHORIZATION header removed by apache
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect to URI without front controller to prevent duplicate content
    # (with and without `/app.php`). Only do this redirect on the initial
    # rewrite by Apache and not on subsequent cycles. Otherwise we would get an
    # endless redirect loop (request -> rewrite to front controller ->
    # redirect -> request -> ...).
    # So in case you get a "too many redirects" error or you always get redirected
    # to the start page because your Apache does not expose the REDIRECT_STATUS
    # environment variable, you have 2 choices:
    # - disable this feature by commenting the following 2 lines or
    # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
    #   following RewriteCond (best solution)
    RewriteCond %{ENV:REDIRECT_STATUS} ^$
    RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]

    # If the requested filename exists, simply serve it.
    # We only want to let Apache serve files and not directories.
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule .? - [L]

    # Rewrite all other queries to the front controller.
    RewriteRule .? %{ENV:BASE}/app.php [L]
</IfModule>

<IfModule !mod_rewrite.c>
    <IfModule mod_alias.c>
        # When mod_rewrite is not available, we instruct a temporary redirect of
        # the start page to the front controller explicitly so that the website
        # and the generated links can still be used.
        RedirectMatch 302 ^/$ /app.php/
        # RedirectTemp cannot be used instead
    </IfModule>
</IfModule>
Top

web-seo-consulting
Posts: 35
Joined: Sat Jun 25, 2016 6:56 pm

Re: Multidomain Installation for CMS and NGINX
  • Quote

Post by web-seo-consulting » Fri Jul 01, 2016 11:04 pm

So habe es endlich am laufen!

Contao4.tpl

Code: Select all

server {
	listen      %ip%:%web_port%;
	server_name %domain_idn% %alias_idn%;
	root        %docroot%/web;
	index       app.php index.php index.html index.htm;
	access_log  /var/log/nginx/domains/%domain%.log combined;
	access_log  /var/log/nginx/domains/%domain%.bytes bytes;
	error_log   /var/log/nginx/domains/%domain%.error.log error;

	location / {

		try_files $uri $uri/ /app.php?$args;

		location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
			expires     max;
		}

		location ~ [^/]\.php(/|$) {
			fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
			if (!-f $document_root$fastcgi_script_name) {
				return  404;
			}

			fastcgi_pass    %backend_lsnr%;
			fastcgi_index   app.php;
			include         /etc/nginx/fastcgi_params;

			fastcgi_split_path_info ^(.+\.php)(/.*)$;
			try_files $uri =404;
		}

		location ~* (/scripts|/system/logs|/system/bin|/system/config) {
			deny all;
		}

		location = /favicon.ico {
			log_not_found off;
			access_log off;
		}
		location = /robots.txt {
			allow all;
			log_not_found off;
			access_log off;
		}
		location ~* \.(tpl|html5|xhtml)$ {
			deny all;
		}

	}

	error_page  403 /error/404.html;
	error_page  404 /error/404.html;
	error_page  500 502 503 504 /error/50x.html;

	location /error/ {
		alias   %home%/%user%/web/%domain%/document_errors/;
	}

	location ~* "/\.(htaccess|htpasswd)$" {
		deny    all;
		return  404;
	}

	include     /etc/nginx/conf.d/phpmyadmin.inc*;
	include     /etc/nginx/conf.d/phppgadmin.inc*;
	include     /etc/nginx/conf.d/webmail.inc*;

	include     %home%/%user%/conf/web/nginx.%domain%.conf*;
}
Contao4.stpl

Code: Select all

server {
	listen      %ip%:%web_ssl_port%;
	server_name %domain_idn% %alias_idn%;
	root        %sdocroot%/web;
	index       app.php index.php index.html index.htm;
	access_log  /var/log/nginx/domains/%domain%.log combined;
	access_log  /var/log/nginx/domains/%domain%.bytes bytes;
	error_log   /var/log/nginx/domains/%domain%.error.log error;

	ssl         on;
	ssl_certificate      %ssl_pem%;
	ssl_certificate_key  %ssl_key%;

	location / {

		try_files $uri $uri/ /app.php?$args;

		location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
			expires     max;
		}

		location ~ [^/]\.php(/|$) {
			fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
			if (!-f $document_root$fastcgi_script_name) {
				return  404;
			}

			fastcgi_pass    %backend_lsnr%;
			fastcgi_index   app.php;
			include         /etc/nginx/fastcgi_params;

			fastcgi_split_path_info ^(.+\.php)(/.*)$;
			try_files $uri =404;
		}

		location ~* (/scripts|/system/logs|/system/bin|/system/config) {
			deny all;
		}

		location = /favicon.ico {
			log_not_found off;
			access_log off;
		}
		location = /robots.txt {
			allow all;
			log_not_found off;
			access_log off;
		}
		location ~* \.(tpl|html5|xhtml)$ {
			deny all;
		}

	}

	error_page  403 /error/404.html;
	error_page  404 /error/404.html;
	error_page  500 502 503 504 /error/50x.html;

	location /error/ {
		alias   %home%/%user%/web/%domain%/document_errors/;
	}

	location ~* "/\.(htaccess|htpasswd)$" {
		deny    all;
		return  404;
	}

	include     /etc/nginx/conf.d/phpmyadmin.inc*;
	include     /etc/nginx/conf.d/phppgadmin.inc*;
	include     /etc/nginx/conf.d/webmail.inc*;

	include     %home%/%user%/conf/web/snginx.%domain%.conf*;
}
Top


Post Reply
  • Print view

13 posts
  • Previous
  • 1
  • 2

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

cron

Login  •  Register

I forgot my password