I'm trying to run a website on both port 80 and 1998 on apache2 and in sites-available my config looks like this:
<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 www.example.com
ServerAdmin admin#mafiakampen.com
DocumentRoot /var/www/html/mv
# 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
<VirtualHost *:1998>
# 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 www.example.com
ServerAdmin admin#mafiakampen.com
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>
Then I restarted apache2 and rsent the command iptables -A INPUT -p tcp --dport 1998 --jump ACCEPT.
Now when I'm going to myserverip:1998 I get that the page isn't available and under that ERR_CONNECTION_REFUSED. How can I fix this?
I forgot to go to /etc/apache2/ports.conf and add Listen 1998
then i added NameVirtualHost *:1998 in my virtualhost
Related
I have a VPS server with SSL Certbot, in Debian with apache, but not working correctly for subdomains. When accessing my subdomain with http://, it goes directly to the directory that I configure.
But, when accessing with https:// protocol, it goes directly to the root directory, that is /var/www/html.
I am new to the VPS servers, and I not know what's the problem.
This is my /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 www.example.com
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
RewriteEngine on
RewriteCond %{SERVER_NAME} =app.mysite.com [OR]
RewriteCond %{SERVER_NAME} =mysite.com [OR]
RewriteCond %{SERVER_NAME} =www.mysite.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
<VirtualHost *:80>
ServerName app.mysite.com
DocumentRoot /var/www/html/app
</VirtualHost>
Thanks for your time
Your configuration sample is missing the configuration for https / port 443.
From your http configuration
<VirtualHost *:80>
ServerName app.mysite.com
DocumentRoot /var/www/html/app
</VirtualHost>
So you should change the DocumentRoot of your SSL-configuration file also to DocumentRoot /var/www/html/app. Probably this file is called 000-default-ssl.conf.
Usually it is a good idea to create is own files and use them instead of the default ones. Especially when you do a dist upgrade and configuration files change this is much less hassle, because when changing default files you get a dialog and have to decide which version you want to keep. Selecting the wrong and you have to restore your changed config-file from a backup.
Hello i am trying to configure a magento site in my localhost i have to change the url from localhost/magento2 to localhost here my apache configuration
<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 www.example.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www/magento2/
# 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
In my database i change the url
but my site looks like this
if a click y link i get 404 not found error for example
http://localhost/women/tops-women/jackets-women.html
Can you please check if you have a .htaccess default file on pub/static location ?
If you are missing that, put one there by copying from default Magento files..
Also if check if you have enabled mod_rewrite module in apache2.
I just purchased a domain from GoDaddy, let's call it example.com. I set it up on GoDaddy to where it forwards people to my home IP Address where my Raspberry Pi hosts my website using Apache2. How can I properly set it up so that it shows example.com in the address bar rather than my home IP address?
Here is my .conf file for my website:
<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 www.example.com
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
If you visited the site via IP address prior to porting and setting a DNS record. You may need to clear your browser and DNS cache. This is how to flush Windows DNS via command line:
ipconfig /flushdns
Note that you MAY have to run cmd as admin.
My Pi version is:
pi#raspberrypi:~ $ uname -a
Linux raspberrypi 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l GNU/Linux
Apache version installed on Pi:
pi#raspberrypi:~ $ apache2 -version
Server version: Apache/2.4.25 (Raspbian)
Server built: 2019-10-13T15:43:54
The web-server is successfully serving a WordPress site on http://localhost. I am trying to enable WebDAV based access simultaneously. I have following two sites configured:
pi#raspberrypi:/etc/apache2/sites-available $ pwd
/etc/apache2/sites-available
pi#raspberrypi:/etc/apache2/sites-available $ cat 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 www.example.com
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
pi#raspberrypi:/etc/apache2/sites-available $ cat 001-default.conf
DavLockDB /usr/local/apache2/var/DavLock
NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/web1/web/
<Directory /var/www/web1/web/>
DAV On
Options Indexes MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
Alias /webdav /var/www/web1/web
<Location /webdav>
AuthType Basic
AuthName "webdav"
AuthUserFile /var/www/web1/passwd.dav
Require valid-user
</Location>
</VirtualHost>
I can see the two sites loaded:
pi#raspberrypi:/etc/apache2/sites-available $ pwd
/etc/apache2/sites-available
pi#raspberrypi:/etc/apache2/sites-available $ apachectl -D DUMP_VHOSTS
AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/sites-enabled/001-default.conf:2
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:80 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
*:* 127.0.1.1 (/etc/apache2/sites-enabled/001-default.conf:3)
pi#raspberrypi:/etc/apache2/sites-available $
However, cadaver cannot reach the webDAV:
pi#raspberrypi:/etc/apache2/sites-available $ cadaver http://localhost/webdav/
Could not access /webdav/ (not WebDAV-enabled?):
405 Method Not Allowed
Connection to `localhost' closed.
dav:!>
What am I doing wrong?
I have a subdomain test.example.com.
I have a java web application running in tomcat 8.5 on port 8086.
In /opt/tomcat/conf/server.xml I have a virtual host defined like below.
<Host name="canicarry.thehatapps.com" appBase="webapps/SecondAmendmentSupporters-0.2" unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="canicarry_access_log" suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
</Host>
I have an apache2 conf defines like below.
/etc/apache2/sites-available/test.example.com.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 www.example.com
ServerAdmin webmaster#localhost
ServerName test.example.com
ServerAlias www.test.example.com.com
DocumentRoot /var/www/test.example.com/public_html
<Directory /var/www/test.example.com/public_html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
# 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>
In public_html I have .htaccess defined like below.
RedirectPermanent / http://test.example.com:8086
My goal is to be able to hit the myapp-02 tomcat web app on port 8086 like so http://canicarry.thehatapps.com:8086
I'm not sure what's wrong but I get 404. I can't seem to resolve http://canicarry.thehatapps.com:8086 to my web app running in tomcat.
Any help would be appreciated.
EDITED-----------
Using this in my apache conf file helped but still running into issues.
<VirtualHost canicarry.thehatapps.com/*:80>
ServerName canicarry.thehatapps.com
ProxyRequests Off
ProxyPass / ajp://localhost:8086/SecondAmendmentSupporters-0.2
ProxyPassReverse / ajp://localhost:8086/SecondAmendmentSupporters-0.2
</VirtualHost>
When I type http://canicarry.thehatapps.com:8086, I'm taken to
http://104.238.96.249:8086/SecondAmendmentSupporters-0.2/
Which is the full url to my tomcat application. However, when I append an endpoint, it doesn't resolve. In addition, the url should still be http://canicarry.thehatapps.com:8086. It shouldn't show the full url to the tomcat application instance.
For example, http://canicarry.thehatapps.com:8086/places should return a list of places from the service but it doesn't resolve the url.
Your <VirtualHost *:80> is telling apache to listen on port 80.
If you want the application to be exposed over port 8086 then you need to proxy the port 8086 to your tomcat server. You can do this using the ajp_proxy module of apache.
<VirtualHost test.example.com:8086>
ServerName test.example.com
ProxyRequests Off
ProxyPass /examples ajp://127.0.0.1:8086/examples
ProxyPassReverse /examples ajp://localhost:8086/examples
</VirtualHost>
See below article for details
https://linuxconfig.org/how-to-set-up-apache-webserver-proxy-in-front-of-apache-tomcat-on-red-hat-linux