I have the following problem:
I want to access a mono application via ssl. I want it to be not accessible without ssl.
I am using apache2.4 and mod-mono-server4.exe 3.0.0.0
At the moment I have a working configuration like this:
<VirtualHost *:80>
DocumentRoot /srv/www/htdocs/my-mono-app
#SSLEngine on
#SSLCertificateFile /path/to/key.pem
#SSLCertificateKeyFile /path/to/key.pem
MonoAutoApplication disabled
MonoServerPath my-mono-app "/usr/bin/mod-mono-server4"
MonoApplications my-mono-app "/my-mono-app:/srv/www/htdocs/my-mono-app"
<Directory /srv/www/htdocs/my-mono-app>
Require all granted
MonoSetServerAlias my-mono-app
SetHandler mono
</Directory>
</VirtualHost>
But as soon as I turn the SSLEngine on and change the port to 443 it does not work anymore. It just says: Object not found! if i navigate to the address.
It does not record any errors in the logs.
Can you help me with this please?
PS: Here is the complete not working configuration:
<VirtualHost *:443>
DocumentRoot /srv/www/htdocs/my-mono-app
SSLEngine on
SSLCertificateFile /path/to/key.pem
SSLCertificateKeyFile /path/to/key.pem
MonoAutoApplication disabled
MonoServerPath my-mono-app "/usr/bin/mod-mono-server4"
MonoApplications my-mono-app "/my-mono-app:/srv/www/htdocs/my-mono-app"
<Directory /srv/www/htdocs/my-mono-app>
Require all granted
MonoSetServerAlias my-mono-app
SetHandler mono
</Directory>
</VirtualHost>
I used mono 5.x once. From that experience what I can recall, mod_mono.conf needed modification for directory path. I reached that solution from Apache access and error logs. I tried many ways before that searching the whole earth - symlinking, purge installation and building from source etc. You may try my way keeping a backup of mod_mono.conf.
<IfModule !mono_module>
LoadModule mono_module "libexec/apache2/mod_mono.so"
</IfModule>
<IfModule mono_module>
AddType application/x-asp-net .config .cs .csproj .dll .resources .resx .sln .vb .vbproj
AddType application/x-asp-net .asax .ascx .ashx .asmx .aspx .axd .browser .licx .master .rem .sitemap .skin .soap .webinfo
MonoAutoApplication enabled
MonoDebug true
MonoServerPath "/usr/bin/mod-mono-server4"
MonoSetEnv LANG=fr_FR.UTF-8
MonoUnixSocket "/tmp/.mod_mono"
<IfModule dir_module>
DirectoryIndex Default.aspx
</IfModule>
<DirectoryMatch "/(bin|App_Code|App_Data|App_GlobalResources|App_LocalResources)/">
Order deny,allow
Deny from all
</DirectoryMatch>
<Location "/my-mono-app">
Order deny,allow
Deny from all
Allow from 127.0.0.1 ::1
SetHandler mono-ctrl
</Location>
</IfModule>
It was too bigger to write as comment, it is possibly not 100% warranted answer, depends on your try. That thing in your config is correct :
Require all granted
MonoSetServerAlias my-mono-app
SetHandler mono
Without that stanza odd errors appear.
Related
CONTEXT. I work on a server running Centos 8.3 with Apache 2.4.37.
In Apache's vhosts.conf configuration file I have this vhost for one of my websites:
<VirtualHost *:80>
ServerAdmin se#site.com
DocumentRoot /var/www/html/site
ServerName site.com
ErrorLog /var/log/httpd/admin-site.com-error_log
CustomLog /var/log/httpd/admin-site.com-access_log common
<Directory "/var/www/html/site">
Options SymLinksIfOwnerMatch
AllowOverride None
Order Allow,Deny
Allow from all
</Directory>
<Files ~ "test\.txt">
Order Allow,Deny
Deny from all
</Files>
<FilesMatch "\.(txt|png)$">
Order Allow,Deny
Deny from all
</FilesMatch>
</VirtualHost>
I have these two different scenarios:
If in the DocumentRoot folder I put only static files (html, css, images, etc), the Files and FilesMatch directives work perfectly and the frontend looks excellent.
If I put a Ghost installation in the DocumentRoot folder, I necessarily have to add the following Proxy directives to the vhost. And when doing so, the frontend looks great too, but the Files and FilesMatch directives NOT work at all, i.e. the browser allows me to open site.com/test.txt and site.com /file.png, when they shouldn't open.
ProxyRequests off
ProxyPass / http://localhost:2368/
ProxyPassReverse / http://localhost:2368/
Any ideas how to get the Files and FilesMatch directives to work on my Ghost installation?
I already tried this:
For those thinking about .htaccess. If I activate AllowOverride so that the .htaccess is read: I already tried and the directives in the .htaccess don't work either.
For those thinking of Deny from all. I know Deny from all is for Apache 2.2, and for 2.4 Require all denied should be used. I have done tests and in my Apache 2.4 the Require does not work, it only works Deny from all.
I installed mod_xsendfile on the apache server, How can I enable this module for the user correctly in Ubuntu 18.04.5 LTS? I need to edit the apache main config file or user config file? Anyone, please help me with it?
here is the user apache configuration
<Directory "/home/users/rowan/www/">
Require all granted
Options FollowSymLinks
</Directory>
# domain.com
<VirtualHost *:80>
ServerName domain.com
ServerAdmin test#gmail.com
DocumentRoot "/home/users/rowan/www/"
SuexecUserGroup "rowan" "rowan"
# log
LogLevel warn
CustomLog "/home/users/rowan/logs/access.log" keyhelp_log
ErrorLog "/home/users/rowan/logs/error.log"
# php support
<FilesMatch "\.php$">
SetHandler "proxy:unix:/run/php/keyhelp_rowan.socket|fcgi://keyhelp_rowan.socket"
</FilesMatch>
# Set some proxy properties (the string "unique-domain-name-string" should match
# the one set in the FilesMatch directive.
<Proxy fcgi://keyhelp_rowan.socket>
ProxySet connectiontimeout=5 timeout=600000
</Proxy>
<Directory "/home/users/rowan/www/">
AllowOverride All
Options -Indexes
CGIPassAuth On
</Directory>
</VirtualHost>
I have an application in Python to which I access via an html document running in Apache, using xampp. I have to type "desktop-6oirdq3:8081/db.html" from a remote device to get to the file. I want to use a friendlier URL and easier to remember. For that, I'm trying to create a VirtualHost in Apache. The path for the file is:
C:/xampp/htdocs/Dashboard/db.html
These are some lines of my httpd.conf:
Listen 8081
DocumentRoot "C:/xampp/htdocs/Dashboard"
<Directory "C:/xampp/htdocs/Dashboard">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm \
default.php default.pl default.cgi default.asp default.shtml default.html
default.htm \
home.php home.pl home.cgi home.asp home.shtml home.html home.htm index.py app.py
</IfModule>
Include conf/extra/httpd-vhosts.conf
ScriptInterpreterSource Registry-Strict
In the httpd-vhosts.conf I have:
NameVirtualHost 192.168.1.134:8081
<VirtualHost 192.168.1.134:8081>
DocumentRoot "C:/xampp/htdocs/Dashboard"
ServerName dashboard.com
</VirtualHost>
<Directory "C:/xampp/htdocs/Dashboard">
Order allow,deny
Allow from all
Options Indexes FollowSymLinks
Require all granted
</Directory>
And finally in the hosts file:
::1 localhost
192.168.1.134 dashboard.com
The thing is, when I activate Apache, and type "dashboard.com" in the searchbar, it says "This site can't be reached". I have no idea what is wrong. Followed several tutorials but don't work it out. Do you have any idea? If you need more code I'll provide it
Thank you!
I'm trying to setup an apache2 server on debian jessie with multiple vhosts. I want each one of them to have a different FastCgiExternalServer. I'm using the php version from php5-fpm package on jessie with default /etc/php5/fpm configuration files.
Basic apache configuration is working fine :
<VirtualHost *:80>
ServerName lalala.org
DocumentRoot "/path/to/app/www"
<Directory "/path/to/app/www">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
Require all granted
</Directory>
FastCgiExternalServer /path/to/app/www -socket /var/run/php5-fpm.sock
AddHandler php-fcgi .php
Action php-fcgi /path/to/app/www
</VirtualHost>
However, I got 403 errors on .css, .js files. I read this article : http://whocares.de/fastcgiexternalserver-demystified/8/, but even with this configuration :
FastCgiExternalServer /path/to/app/www -socket /var/run/php5-fpm.sock
AddHandler php-fcgi .php
Action php-fcgi /virtualpath
Alias /virtualpath /path/to/app/fcgi-uri
(/path/to/app/fcgi-uri is a symlink to /path/to/app/www)
It doesn't work. It's as if I had a local problem but can't figure out what.
Thanks
EDIT :
I found a solution that makes fastcgi execution work :
<FilesMatch \.php$>
SetHandler "proxy:unix:/path/to/sock/socket.sock|fcgi://localhost"
</FilesMatch>
But I think this is more a workaround than a solution.
I am using apache 2.2.22 with debian stable as the server.
I have created a virtual host for a webdav share. I can access all of the symbolic links contained in /webdav via a web browser, just not from a webdav client. If i put documents or proper folders within /webdav i can see them in a client.
Here is my config for the share:
<VirtualHost *:80>
ServerAdmin webmaster#mydomain.com
ServerName mydomain.com
ServerAlias *.mydoman.com
DirectoryIndex index.html
Options Indexes FollowSymLinks
DocumentRoot /var/www/html/www.mydomain.com/htdocs/
ScriptAlias /cgi-bin/ /var/www/html/www.mydomain.com/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
ErrorLog /var/www/html/www.mydomain.com/logs/error.log
CustomLog /var/www/html/www.mydomain.com/logs/access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerAdmin webmaster#mydomain.com
ServerName mydomain.com
ServerAlias *.mydomain.com
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/mykey.crt
SSLCertificateKeyFile /etc/apache2/ssl/mykey.key
DirectoryIndex index.html
Options Indexes FollowSymLinks
DocumentRoot /var/www/html/www.mydomain.com/htdocs/
ScriptAlias /cgi-bin/ /var/www/html/www.mydomain.com/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
ErrorLog /var/www/html/www.mydomain.com/logs/error.log
CustomLog /var/www/html/www.mydomain.com/logs/access.log combined
Alias /webdav /var/www/html/mydomain/htdocs
<Location /webdav-public>
Options Indexes FollowSymLinks
#AllowOverride None
DAV On
AuthType Basic
AuthName "webdav"
AuthUserFile /etc/apache2/webdav.password
Require valid-user
</Location>
</VirtualHost>
Permissions for root and webdav folder:
Owner: root, create/delete; Group www-data, access; Other, none
Permissions for the public folder which the symlinks point to:
Owner: myusername, create/delete; Group: www-data, access; Other, Access
Any ideas? Obviously i am trying to learn my way around apache so there is probably a few errors in the above, i welcome any off topic criticism.
So, it turns out:
<Location /webdav-public>
A location as above can be a symbolic link. However, symbolic links within the share location are not supported for whatever reason (at least for apache 2.2.22 in the debian stable repo). They do show when accessed by firefox or chrome for me, but not from a webdav client or while mapped in windows explorer (while on the home network, not tested elsewhere).
I had to rearrange my files to suit webdav, which sucks.