Author Topic: htacces will not be performed  (Read 29 times)

spicer

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • ltspiceusers.ch
htacces will not be performed
« on: October 14, 2019, 08:44:34 pm »
First: Excuse my terrible english ^^
I run a Ubuntu 18.04 with EHCP force panel.
I have created a domain yyyy.ch
The htaccess file will not be processed.
I show the  /etc/apache2/sites-enabled/default
There is
Code: [Select]
# this file used in Easy Hosting Control Panel (ehcp), www.ehcp.net

<VirtualHost *:80>

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
 
RewriteCond %{SERVER_NAME} =email.yyyy.ch [OR]
RewriteCond %{SERVER_NAME} =mail.yyyy.ch [OR]
RewriteCond %{SERVER_NAME} =webmail.yyyy.ch
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

# this file used in Easy Hosting Control Panel (ehcp), www.ehcp.net

<VirtualHost *:443>

    ServerName ssl
    DocumentRoot /var/www/new
    <Directory />
        Options +FollowSymLinks
        AllowOverride None
    </Directory>

    <Directory /var/www/vhosts/>
        Options -Indexes -FollowSymLinks -MultiViews
        AllowOverride All
        Order Allow,Deny
        Allow from All
    </Directory>

    <FilesMatch "access_log|error_log">
        Deny from All
    </FilesMatch>
 
    <Files  ~ "\.conf$">
        Order allow,deny
        Deny from all
    </Files>
     
    <Files  ~ "\.txt$">
        Order allow,deny
        Deny from all
    </Files>
 
    <Files  ~ "\.log$">
        Order allow,deny
        Deny from all
    </Files>
 
    <Files  ~ "\.sh$">
        Order allow,deny
        Deny from all
    </Files>

    LogLevel debug
    ErrorLog /var/log/apache2/default.error.log
    CustomLog /var/log/apache2/default.access.log vhost_combined

    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/server.crt
    SSLCertificateKeyFile /etc/ssl/private/server.key
 
    ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9001/var/www/new/$1
    ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir=/var/www:/tmp:/usr/share:/etc/roundcube:/etc/phpmyadmin:/var/lib/phpmyadmin:/var/lib/roundcube:/var/log/roundcube; \n upload_tmp_dir=/tmp; \n session.save_path=/var/www/php_sessions;"

</VirtualHost>
 

# a2enmod rewrite
say
Module rewrite already enabled

See also:
https://www.xendach.de/threads/htaccess-wird-nicht-ausgefuehrt.6902/

I run a Xenforo 2.1.4 on this machine and ssl is activated (certbot).
Without htaccess i have no redirects and no security :(

I do not understand that. Can someone help?
« Last Edit: October 15, 2019, 07:47:27 am by spicer »
Wenn es mehrere Möglichkeiten gibt, eine Aufgabe zu erledigen, und eine davon in einer Katastrophe endet oder sonstwie unerwünschte Konsequenzen nach sich zieht, dann wird es jemand genau so machen. Alles, was schiefgehen kann, wird auch schiefgehen.
(Murphys Gesetz)

earnolmartin

  • Administrator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
Re: htacces will not be performed
« Reply #1 on: October 15, 2019, 12:58:57 pm »
.htaccess files are a bad idea in general.

In your case, for apache2, you will need to add ProxyPassMatch rewrite rules into the domain's custom apache2 web server template since EHCP Force Edition runs on Apache versions newer than 2.4.26 using mod_proxy_fcgi (http://httpd.apache.org/docs/2.4/mod/mod_proxy_fcgi.html):

Here's the guide:

https://serverfault.com/questions/398834/understanding-apache-2-4-mod-proxy-fcgi-and-rewriterules-in-htaccess

nginx syntax allows you to create try files directives placed in the custom nginx templates to make permalink structures work:

https://www.nginx.com/resources/wiki/start/topics/recipes/xenforo/

Let me know if I can be of more help.

spicer

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • ltspiceusers.ch
Re: htacces will not be performed
« Reply #2 on: October 15, 2019, 02:47:05 pm »
Thank you for reply

I not understand "into the domain's custom apache2 web server template".
Where is the location of this file with content
Code: [Select]
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.2:9126/<path>/$1and what's the name of it?
Is this in the forum (domain) root a sub-folder called php-fpm?

# a2enconf php7.2-fpm
Conf php7.2-fpm already enabled

I edit /etc/apache2/sites-enabled/default

ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9001/var/www/new/$1
ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9001/var/www/vhosts/yyyy.ch/yyyy.ch/httpdocs/$1

Works not.
« Last Edit: October 15, 2019, 04:13:28 pm by spicer »
Wenn es mehrere Möglichkeiten gibt, eine Aufgabe zu erledigen, und eine davon in einer Katastrophe endet oder sonstwie unerwünschte Konsequenzen nach sich zieht, dann wird es jemand genau so machen. Alles, was schiefgehen kann, wird auch schiefgehen.
(Murphys Gesetz)

earnolmartin

  • Administrator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
Re: htacces will not be performed
« Reply #3 on: October 15, 2019, 05:00:18 pm »
php is already enabled from a fresh installation if you use EHCP Force Edition.

Login to the EHCP panel, select the domain that has been added to the panel that you want to customize, and then click on "Edit Apache2 Template".  This is the domain specific template which can be modified to accomplish anything custom you might need (but you could end up breaking your web server if you use invalid syntax).  If that happens, simply clear the contents of /var/www/new/ehcp/apachehcp.conf and restart the web server.  Undo your breaking changes, and then resync the domains. 

You should be using the panel to make any additions or customizations to any web server template.  Thus, you would login to the panel at http://localhost/ehcp

I hope this helps. 
« Last Edit: October 15, 2019, 05:03:24 pm by earnolmartin »

spicer

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • ltspiceusers.ch
Re: htacces will not be performed
« Reply #4 on: October 15, 2019, 07:29:50 pm »
Ey thx :D

Code: [Select]
# ProxyPassMatch ^(.*\.php)$ fcgi://127.0.0.1:9000{homedir}/httpdocs/$1

<Directory {homedir}/httpdocs>
    Options -Indexes +FollowSymLinks -ExecCGI +MultiViews

    AllowOverride All

    <IfModule mod_proxy_fcgi.c>
        RewriteEngine On
        RewriteBase /
        RewriteOptions InheritBefore
        RewriteCond %{REQUEST_FILENAME} -f
        RewriteRule ^([^\.]+\.php)$ fcgi://127.0.0.1:9000{homedir}/httpdocs/$1 [L,P]
    </IfModule>

    Order allow,deny
    allow from all

    <IfVersion >= 2.4>
        Require all granted
    </IfVersion>
</Directory>

solve the problem.
« Last Edit: October 15, 2019, 09:02:17 pm by spicer »
Wenn es mehrere Möglichkeiten gibt, eine Aufgabe zu erledigen, und eine davon in einer Katastrophe endet oder sonstwie unerwünschte Konsequenzen nach sich zieht, dann wird es jemand genau so machen. Alles, was schiefgehen kann, wird auch schiefgehen.
(Murphys Gesetz)

spicer

  • Newbie
  • *
  • Posts: 8
    • View Profile
    • ltspiceusers.ch
Re: htacces will not be performed
« Reply #5 on: October 16, 2019, 09:11:57 am »
Code: [Select]
# certbot
Error while running nginx -c /etc/nginx/nginx.conf -t.

nginx: [emerg] unexpected ">" in /var/www/new/ehcp/apachehcp.conf:69
nginx: configuration file /etc/nginx/nginx.conf test failed

This machine runs in a LXC container! Is that the problem?
Code: [Select]
# systemctl status nginx.service
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:nginx(8)

Oct 16 19:38:38 servername systemd[1]: nginx.service: Failed to reset devices.list: Operation not permitted
Oct 16 19:38:38 servername systemd[1]: nginx.service: Failed to reset devices.list: Operation not permitted
Oct 16 19:42:49 servername systemd[1]: nginx.service: Failed to reset devices.list: Operation not permitted
Oct 16 19:42:49 servername systemd[1]: nginx.service: Failed to reset devices.list: Operation not permitted
Oct 16 19:42:49 servername systemd[1]: nginx.service: Failed to reset devices.list: Operation not permitted
Oct 16 19:42:50 servername systemd[1]: nginx.service: Failed to reset devices.list: Operation not permitted
Oct 16 19:42:50 servername systemd[1]: nginx.service: Failed to reset devices.list: Operation not permitted
Oct 16 19:42:50 servername systemd[1]: nginx.service: Failed to reset devices.list: Operation not permitted
Oct 16 19:42:55 servername systemd[1]: Stopping A high performance web server and a reverse proxy server...
Oct 16 19:42:55 servername systemd[1]: Stopped A high performance web server and a reverse proxy server.

Edit:
Now I have buy a signed certificate.
Problem solved.
« Last Edit: October 16, 2019, 02:31:39 pm by spicer »
Wenn es mehrere Möglichkeiten gibt, eine Aufgabe zu erledigen, und eine davon in einer Katastrophe endet oder sonstwie unerwünschte Konsequenzen nach sich zieht, dann wird es jemand genau so machen. Alles, was schiefgehen kann, wird auch schiefgehen.
(Murphys Gesetz)