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.
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.
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.
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
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
This days I sleep with my http://localhost working, and reading pages from /var/www...
I woke up with an "AH00094" error at Apache2 log, and (Apache2 created?) a surprised /var/www/html, that Apache2 try to use.
Now my http://localhost/anything not works (error 404 at browser).
How to fix it? I need back my http://localhost working with files at /var/www!
Context
I am using Ubuntu12 with Apache2, all default and standard.
I checked out error log by tail /var/log/apache2/error.log in order to find out exact path that Apache, that shows
... [core:notice] [pid 1597] AH00094: Command line: '/usr/sbin/apache2'
... [:error] [pid 1604] [client 127.0.0.1:40624] script '/var/www/html/info.php' not found or unable to stat
The folder /var/www/html is new, all, like '/var/www/info.php', are at /var/www, not at /var/www/html.
I fixed the "AH00094" error editing
sudo nano /etc/apache2/apache2.conf
and adding at last line
ServerName localhost
(now no log errors about localhost, but nothing works)
PS: I checked other related issues, but not is the same problem: Permissions for /var/www/html , Attempting to use symbolic link for var/www/html
I'm afraid to use the clues of this answer ... in my Ubuntu there are no the .conf indicated files. I must create it? Is secure?
As #RahilWazir suggested, here is also 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
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
See here:
Why has the apache2 www dir been moved to /var/www/html?
The default directory apparently (we were also surprised) moved from /var/www to /var/www/html for htdocs in Debian, and Ubuntu copied this change. The reasons given are somewhat sound, but the upgrade path is probably “interesting” (as in the Chinese proverb)… as you have encountered.
If you want to use /www as root folder instead of /www/html you can simply edit the apache2 config file to have /var/www
Edit 000-default.conf
sudo gedit /etc/apache2/sites-available/000-default.conf
then change
DocumentRoot /var/www/html
to
DocumentRoot /var/www
Restart apache2 server :
sudo service apache2 restart