First I want to say that I probably read everything that there is on the internet regarding the problem.
And the problem is that I can not access my owncloud over doc.selfhost.eu if I am in the same network. But I can access it from inside the network over its internal IP (192.168.2.200) and from outside the network over doc.selfhost.eu.
My setup:
A home server running Linux Mint 17.2 Cinnamon which is supposed to be for media and to run owncloud.
The server is connected to a Speedport 723v which doesn't support NAT Loopback. Ports 80 and 443 are forwarded and for dynamic DNS I have an account on selfhost.de which I entered in the router settings.
On my Windows 7 machine (which I'm trying to access the server from) I entered 192.168.2.200 (the servers internal IP) as DNS.
In Mint I disabled network manager (in fact I removed it) and I am now using interfaces.
Not a solution would be to change the hosts files of all the clients (on unrooted androids this isn't even possible).
Questions:
What would I have to change to access my owncloud from the internal network over the external IP?
Is it possible to not configure the clients at all? Meaning no entering the servers DNS or changing hosts in the clients for it to work properly.
In the following you can see all the files I fiddled around with and which I think might be relevant.
/etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.2.200
netmask 255.255.255.0
gateway 192.168.2.1
dns-nameservers doc.selfhost.eu 8.8.8.8
/etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1
In /etc/dnsmasq.conf this is the only thing I added:
listen-address=127.0.0.1
listen-address=192.168.2.200
address=/doc.selfhost.eu/192.168.2.200
/etc/dnsmasq.d/doc.selfhost.eu (read somewhere to create this)
address=/doc.selfhost.eu/192.168.2.200
/etc/hosts
127.0.0.1 localhost
127.0.1.1 doc-desktop
192.168.2.200 doc.selfhost.eu
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Owncloud settings in
/var/www/owncloud/config/config.php
'trusted_domains' =>
array (
0 => '192.168.2.200',
1 => 'doc.selfhost.eu',
);
Apache configuration
In /etc/apache2/apache2.conf everything is pretty standard. I only added:
ServerName doc-desktop
/etc/apache2/sites-enabled/owncloud.conf. No changes in sites-available, no linking.
<VirtualHost 192.168.2.200:80>
#### Redirect to port 443 ###
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
#### End of Redirection configuration ###
DocumentRoot /var/www/owncloud/
<Directory /var/www/owncloud>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost 192.168.2.200:443>
####Configuration for SSL #####
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
#### End of SSL Configuration ####
Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"
DocumentRoot /var/www/owncloud/
<Directory /var/www/owncloud>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
In case it comes up.
from server:
dig doc.selfhost.eu
; <<>> DiG 9.9.5-3ubuntu0.5-Ubuntu <<>> doc.selfhost.eu
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 49046
;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;doc.selfhost.eu. IN A
;; ANSWER SECTION:
doc.selfhost.eu. 0 IN A 192.168.2.200
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Oct 26 02:35:15 CET 2015
;; MSG SIZE rcvd: 54
From client inside network (with cygwin):
dig doc.selfhost.eu
; <<>> DiG 9.10.3 <<>> doc.selfhost.eu
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29482
;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;doc.selfhost.eu. IN A
;; ANSWER SECTION:
doc.selfhost.eu. 0 IN A 192.168.2.200
;; Query time: 31 msec
;; SERVER: 192.168.2.200#53(192.168.2.200)
;; WHEN: Mon Oct 26 02:37:32 2015
;; MSG SIZE rcvd: 54
I hope this is everything.
Thanks.
... which doesn't support NAT Loopback. ....
What would I have to change to access my owncloud from the internal network over the external IP?
If you insist of using the external IP address from inside then you have to replace the router against a model which supports NAT Loopback (NAT hairpinning or NAT reflection or whatever you call it). There is no way around because connection with the external IP address will go through the router.
Is it possible to not configure the clients at all? Meaning no entering the servers DNS or changing hosts in the clients for it to work properly. ..
You might try to run your own DNS server and tell the clients via DHCP to use this DNS server. This DNS server then could provide the internal IP of your home server. I doubt that this can be done on the router itself but you could probably run DNS and DHCP on your home server and disable DHCP on the router.
For specific question on how to set up DNS and DHCP please head over to superuser.com or serverfault.com since this is off-topic here.
Related
Soo we bough a domain name with the name of mastergamingteam.eu and we've been trying to make it work, but it does not seem to. I've tried a lot of stuff online, but we still can't connect to the page.
From client side it says DNS_PROBE_FINISHED_NXDOMAIN
We use ubuntu 16.04.6
/etc/apache2/sites-available/000-default.conf:
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName mastergamingteam.eu
ServerAlias www.mastergamingteam.eu
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
/etc/hosts(This keeps getting overwritten, this is there by default):
# Generated by SolusVM
127.0.0.1 localhost localhost.localdomain
::1 localhost localhost.localdomain
79.139.56.118 mastergamingteam
Port 80 is enabled by ufw and Listened in apache2
A Record:
mastergamingteam.eu priority:0 TTL:7200 Type:A Value:79.139.56.118
NS Record:
mastergamingteam.eu priority:0 TTL:86400 Type:NS Value:ns1.rackforest.hu
The VPS is hosted by rackforest and bought the domain on their site.
Domain record at registrar has errors in name servers' hostnames.
$whois mastergamingteam.eu
Domain: mastergamingteam.eu
...
Registrar:
Name: PDR Ltd.
Website: https://www.publicdomainregistry.com
Name servers:
sn1.rackforest.hu
sns1.racforest.hu
You should edit record registrar and put ns1.rackforest.hu as the first name server.
Also there is only one NS record for your domain.
$ host -t ns mastergamingteam.eu ns1.rackforest.hu
Using domain server:
Name: ns1.rackforest.hu
Address: 185.43.204.2#53
Aliases:
mastergamingteam.eu name server ns1.rackforest.hu
You should probably have ns2.rackforest.hu as second name server.
ns2.rackforest.hu knows about your domain.
$host mastergamingteam.eu ns2.rackforest.hu
Using domain server:
Name: ns2.rackforest.hu
Address: 79.172.213.19#53
Aliases:
mastergamingteam.eu has address 79.139.56.118
the problem here is:
your domain points nowhere. There are no records for your domain (no A or CNAME or any other relevant records) neither are any nameservers configured.
Make sure to set records, as obviously the domain won't work.
You can check your domain's records yourself here: https://digwebinterface.com/?hostnames=mastergamingteam.eu&type=&ns=resolver&useresolver=8.8.4.4&nameservers=
EDIT: I HAVE SINCE FIXED IT BY ALLOWING PORT 80 THROUGH UFW (sudo ufw allow 80)(sudo service ufw status verbose)
I've been fiddling with this for a while and can't figure it out, the issue I'm having is that the dev subdomain outputs files of the main server, you can find relevant info attached below.
I have changed my domain to abc.com, and changed the IP.
Yes, the config is enabled, and Apache has been restarted, but I'm still being served the file /var/www/abc.com/public/index.php rather than /var/www/dev.abc.com/public/index.php.
At this point, I've given up due to my lack of Linux + Apache knowledge.
Zone file:
$ORIGIN abc.com.
$TTL 1800
abc.com. IN SOA ns1.digitalocean.com. hostmaster.abc.com. 1467393676 10800 3600 604800 1800
abc.com. 1800 IN NS ada.ns.cloudflare.com.
abc.com. 1800 IN NS neil.ns.cloudflare.com.
abc.com. 1800 IN A XXX.XXX.XXX.XXX
www.abc.com. 1800 IN CNAME abc.com.
dev.abc.com. 1800 IN A XXX.XXX.XXX.XXX
/etc/hosts:
127.0.1.1 ubuntu-512mb-nyc2-01 ubuntu-512mb-nyc2-01
127.0.0.1 localhost
XXX.XXX.XXX.XXX abc.com
XXX.XXX.XXX.XXX www.abc.com
XXX.XXX.XXX.XXX dev.abc.com
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
abc.com.conf:
NameVirtualHost XXX.XXX.XXX.XXX:80
ServerName abc.com
<VirtualHost XXX.XXX.XXX.XXX:80>
ServerName abc.com
ServerAlias www.abc.com
DocumentRoot /var/www/abc.com/public/
</VirtualHost>
<VirtualHost XXX.XXX.XXX.XXX:80>
ServerName dev.abc.com
ServerAlias www.dev.abc.com
DocumentRoot /var/www/dev.abc.com/public/
</VirtualHost>
Try removing 'ServerName abc.com' from below the 'NameVirtualHost' part; it can mess your config
Have you checked the general error log? Maybe the reboot failed because of a misconfiguration?
I've this configuration for my virtual host and runs with real domains. For testing purpose I need create same virtual host with non real domain (i.e. domain10). Considerated that the browser check the name of domain of virtual host, I think using something like 127.0.0.1. But I've no idea to realize this.
<VirtualHost *:80>
ServerAdmin info#domain10.org
ServerName domain10.org
ServerAlias domain10.org
DirectoryIndex index.html index.htm index.php
DocumentRoot /home/domain10.org/
<Directory /home/domain10.org/>
Options -Includes -Indexes -FollowSymLinks -ExecCGI +MultiViews
AllowOverride none
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
You can use the /etc/hosts file for this purpose. There should already be a line in it beginning with 127.0.0.1. Just add domain10.org to the list of hosts that resolves to this address.
For example, if the existing line is:
127.0.0.1 localhost localhost.localdomain
Just extend it to:
127.0.0.1 localhost localhost.localdomain domain10.org
Then (on this machine only) domain10.org will resolve to 127.0.0.1. If you are testing on the same machine, you can enter http://domain10.org/ in your browser to reach your local web server.
If you need to reach this host over the Internet, then a different approach is needed. Look for a line for the external IP address of the server in its /etc/hosts file and modify it similar to the above instructions. If such a line does not exist, add one.
On the client machine, do the same (using /etc/hosts for a Linux box or %WINDIR%\system32\drivers\etc\hosts for a Windows box). You should then be able to reach the server from the client using this name.
I set Centos 6.3 up on a Rackspace box, using a static IP address (not a FQDN). I will be setting up virtual hosts on this box, and it seems to be working fine, but when I restart the HTTPD server, I get an error message "could not reliably determine the server's fully qualified domain name, using xx.xxx.xx.xx for ServerName" (xx.xxx.xx.xx is the static IP address for the server).
My /etc/hosts has the following in it:
27.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
xx.xxx.xx.xx name-used-for-rackspace
name-used-for-racspace is a name (not a FQDN) I used when I created the server (you have to enter a name).
I assume that I may not have to change anything in /etc/hosts, but what do I put in httpd.conf? right now, I have the following in that file:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName localhost
<Directory /var/www/html>
allow from all
Options +Indexes
</Directory>
</VirtualHost>
I also tried setting ServerName to xx.xxx.xx.xx, but I got the same error message.
This error is because you are not using a FQDN. It should not affect the operation of the webserver.
To get rid of the message on startup you'd need to configure your hosts file with the correct domain and IP address. Your httpd.conf should also use the same name (where you have localhost specified).
As long as your server is starting and you don't plan on assigning a domain to your webserver, this error can be ignored.
Example virtual host with FQDN:
<VirtualHost *:80>
ServerName www.domain.net
ServerAlias domain.net *.domain.net
ServerAdmin administrator#domain.net
DocumentRoot "/home/domain/htdocs"
<Directory "/home/domain/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
CustomLog "/home/domain/logs/access-www.log" common
ErrorLog "/home/domain/logs/error-www.log"
<IfModule mpm_peruser_module>
ServerEnvironment apache apache
</IfModule>
</VirtualHost>
Example hosts file:
127.0.0.1 localhost localhost.localdomain gentoo1
x.x.x.x gentoo1.domain.net
You need to configure the network connection with your static IP, see reference below. Otherwise, your web server is working, but it's not accessible externally.
https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/sec-Configuring_IPv4_Settings.html
Then put the static IP in the httpd.conf after server name.
I blocked an IP using htaccess:
order allow,deny
deny from dynamicip-176-212-139-222.pppoe.barnaul.ertelecom.ru
allow from all
But it seems the IP still gets access as my access log file still shows many entries of this IP with the code 200.
With other IPs it worked perfectly fine (there are about 700 deny-from-entries in the htaccess).
Any idea?
Thanks
dynamicip-176-212-139-222.pppoe.barnaul.ertelecom.ru. does not resolve to anything:
;; QUESTION SECTION:
;dynamicip-176-212-139-222.pppoe.barnaul.ertelecom.ru. IN A
;; AUTHORITY SECTION:
barnaul.ertelecom.ru. 3595 IN SOA ns6.ertelecom.ru. noc.ertelecom.ru. 2012042601 86400 1800 604800 86400
You can simply add the IP address instead of the domain name:
deny from 176.212.139.222