Multidomain Installation for CMS and NGINX
-
- Posts: 35
- Joined: Sat Jun 25, 2016 6:56 pm
Re: Multidomain Installation for CMS and NGINX
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
nun läuft es soweit. Ich kann die Seite ohne /web aufrufen.
So nun die nächsten Fehler ausräumen :D
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;
So nun die nächsten Fehler ausräumen :D
-
- Posts: 35
- Joined: Sat Jun 25, 2016 6:56 pm
Re: Multidomain Installation for CMS and NGINX
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:
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>
-
- Posts: 35
- Joined: Sat Jun 25, 2016 6:56 pm
Re: Multidomain Installation for CMS and NGINX
So habe es endlich am laufen!
Contao4.tpl
Contao4.stpl
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*;
}
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*;
}