Nuxt subdomain only works with localhost - dns

I need to get subdomain on Nuxt. So I use const domain = window.location.hostname and it works perfectly fine when for exemple I try exemple.localhost:3000
But when I try to change the hosts and try to do exemple.mydomain:3000 my browser can't find it while mydomain:3000 works
nuxt launch script as dev:
nuxt --hostname 'mydomain' --port 3000
and etc/hosts :
127.0.0.1 localhost mydomain mydomain.local
# 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
nuxt.config.js :
server: {
host: 'mydomain'
port: 3000
}

Related

Configuration virtual hosts

I try to configure virtual hosts. All I do step by step like here
My config:
root#ubuntu:/etc/apache2/sites-available# cat mmv.com.conf
# create new for [mmv.com]
<VirtualHost *:80>
ServerName www.mmv.com
ServerAdmin webmaster#virtual.host
DocumentRoot /var/www/mmv.com
ErrorLog /var/log/apache2/mmv.com.error.log
CustomLog /var/log/apache2/mmv.com.access.log combined
LogLevel warn
</VirtualHost>
My index.html in root folder
cat /var/www/mmv.com/index.html
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Virtual Host Test Page
</div>
</body>
</html>
My /etc/hosts
127.0.0.1 localhost
127.0.1.1 ubuntu
# 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
192.168.125.137 www.mmv.com
Looks like all I did right but if I try to open site www.mmv.com and I see default apache page.
Help me to find where I did mistake.
Thanks!
Try this:
ln -s /etc/apache2/sites-available/mmv.com.conf /etc/apache2/sites-enabled
Then restart your apache server.
Stupid guess: the file is in sites-available, but was it enabled?
If you have debian you can use a2ensite mmv.com, otherwise you have to use ln -s as Kiani advised in ^^^.
I found a solution! That right config:
VirtualHost 192.168.125.138:80>
ServerName www.mmv.com
ServerAlias mmv.com *.mmv.com
ServerAdmin webmaster#mmv.com
DocumentRoot /var/www/www.mmv.com
ErrorLog /var/log/apache2/mmv.com.error.log
CustomLog /var/log/apache2/mmv.com.access.log combined
</VirtualHost>
And in file /etc/hosts have to be this:
192.168.125.138 mmv.com www.mmv.com

IIS host name binding gives a 404 error, works when empty

I have a somewhat weird problem on my IIS server, running a ASP.NET Core application.
The server runs correctly when there is a binding with an empty host name (wildcard). The localhost and domain name can access it correctly using this method. When putting a localhost binding only, it works on localhost, however, when putting my host name (www.mywebsite.com, mywebsite.com), accessing the website using the domain name results in an error 404.
I tried to configure my hosts file as far as I can:
127.0.0.1 localhost
::1 localhost
127.0.0.1 mywebsite.com
127.0.0.1 www.mywebsite.com
::1 mywebsite.com
::1 www.mywebsite.com
(obviously replace mywebsite.com by the real domain name)
Thanks!

Cannot get Apache to reverse proxy my node.js app (https)

I'm trying to get my node app running by just typing in the regular domain instead of appending a dev port at the end (:8081). I cant seem to get it working right, it appears like the reverse proxy virtual host I set up in the conf file is just being ignored. My httpd.conf file gets automatically generated so I have this in a pre_virtualhost_global.conf file:
<VirtualHost *:443>
ServerName www.statementdigest.com
SSLEngine On
ProxyPreserveHost On
ProxyRequests Off
<Directory "/home/statementdigest/myapp">
AllowOverride All
</Directory>
# Set the path to SSL certificate
# Usage: SSLCertificateFile /path/to/cert.pem
SSLCertificateFile /var/cpanel/ssl/cpanel/mycpanel.pem
SSLCertificateKeyFile /var/cpanel/ssl/cpanel/mycpanel.pem
SSLCertificateChainFile /var/cpanel/ssl/cpanel/mycpanel.pem
# Servers to proxy the connection, or;
# List of application servers:
# Usage:
# ProxyPass / http://[IP Addr.]:[port]/
# ProxyPassReverse / http://[IP Addr.]:[port]/
# Example:
<Location /appserver.js>
ProxyPass http://127.0.0.1:8081
ProxyPassReverse http://127.0.0.1:8081
</Location>
# Or, balance the load:
# ProxyPass / balancer://balancer_cluster_name
</VirtualHost>
apachectl -S shows
173.237.185.229:80 is a NameVirtualHost
default server 173.237.185.229 (/etc/apache2/conf/httpd.conf:259)
port 80 namevhost 173.237.185.229 (/etc/apache2/conf/httpd.conf:259)
alias server.statementdigest.com
port 80 namevhost statementdigest.com (/etc/apache2/conf/httpd.conf:325)
alias mail.statementdigest.com
alias www.statementdigest.com
port 80 namevhost proxy-subdomains-vhost.localhost (/etc/apache2/conf/httpd.conf:523)
wild alias cpanel.*
wild alias whm.*
wild alias webmail.*
wild alias webdisk.*
wild alias cpcalendars.*
wild alias cpcontacts.*
173.237.185.229:443 is a NameVirtualHost
default server statementdigest.com (/etc/apache2/conf/httpd.conf:394)
port 443 namevhost statementdigest.com (/etc/apache2/conf/httpd.conf:394)
alias mail.statementdigest.com
alias www.statementdigest.com
alias cpanel.statementdigest.com
alias webdisk.statementdigest.com
alias whm.statementdigest.com
alias webmail.statementdigest.com
port 443 namevhost proxy-subdomains-ssl-default-vhost.localhost (/etc/apache2/conf/httpd.conf:624)
wild alias cpanel.*
wild alias whm.*
wild alias webmail.*
wild alias webdisk.*
wild alias cpcalendars.*
wild alias cpcontacts.*
port 443 namevhost server.statementdigest.com (/etc/apache2/conf/httpd.conf:755)
127.0.0.1:80 proxy-subdomains-vhost.localhost (/etc/apache2/conf/httpd.conf:523)
127.0.0.1:443 proxy-subdomains-ssl-default-vhost.localhost (/etc/apache2/conf/httpd.conf:624)
*:* server.statementdigest.com (/etc/apache2/conf/httpd.conf:285)
*:443 is a NameVirtualHost
default server www.statementdigest.com (/etc/apache2/conf.d/includes/pre_virtualhost_global.conf:4)
port 443 namevhost www.statementdigest.com (/etc/apache2/conf.d/includes/pre_virtualhost_global.conf:4)
port 443 namevhost server.statementdigest.com (/etc/apache2/conf/httpd.conf:755)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/etc/apache2/htdocs"
Main ErrorLog: "/etc/apache2/logs/error_log"
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex ssl-cache: dir="/run/apache2" mechanism=fcntl
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex rewrite-map: dir="/run/apache2" mechanism=fcntl
Mutex ssl-stapling-refresh: using_defaults
PidFile: "/run/apache2/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
Define: MODSEC_2.5
Define: MODSEC_2.9
User: name="nobody" id=99
Group: name="nobody" id=99
typing in the domain still routes to the cgi-bin page so it seems like the virtual host proxy is just being ignored. I will gladly provide any more details that are needed, please ask. I've been grinding on this a few days now and i'm a bit stuck, any help or direction would be very much appreciated, thank you!

Setting up multiple virtual hosts in Apache2

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?

Block websites in Debian

I am trying to block websites using /etc/hosts.
Here is my hosts file.
127.0.0.1 localhost
127.0.1.1 debian.localhost debian
#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
0.0.0.0 facebook.com
127.0.0.1 https://facebook.com
Since it is not working,Please tell me what is going wrong ?
i think you are trying to block facebook from the host file.Just remove other IPV6 entries from your hosts file. (to make it more readable)
try to add following
127.0.0.1 facebook.com (you don't need to put http in front of the domain name)
NOTE : you can put any address in front of your domain. but it is easy to put 127.0.0.1.
so your computer will try to resolve facebook.com and then query the hosts file first. It will return 127.0.0.1 instead of the actual facebook ip address.
I don't know if it's right, but when I tried doing the same, I had to block many other addresses, since you have many domains that are linked to Facebook.
In my case, I had to add those lines :
127.0.0.1 www.facebook.com
127.0.0.1 facebook.com
127.0.0.1 static.ak.fbcdn.net
127.0.0.1 www.static.ak.fbcdn.net
127.0.0.1 login.facebook.com
127.0.0.1 www.login.facebook.com
127.0.0.1 fbcdn.net
127.0.0.1 www.fbcdn.net
127.0.0.1 fbcdn.com
127.0.0.1 www.fbcdn.com
127.0.0.1 static.ak.connect.facebook.com
127.0.0.1 www.static.ak.connect.facebook.com
And it worked perfectly well, whether on Debian, Ubuntu or Fedora. I guess that when you try to go on Facebook, you must be using a domain other that the simple "facebook.com".

Resources