I have Vue3 application with router. History mode is enabled so I would expect that I will be able to write vue.domain.com/path/to/view to the browser address bar and go to the required page. But as I see router create urls like expected but I can not refresh the page or go directly to another location via address bar. You can see an example here with login page https://vue.tatrytec.eu/ Try refresh and you will see 404 not found error. The whole repository is on Github.
Can somebody tell me please what is the solution of this problem?
EDIT
I found solution but I am not sure if this Apache settings are correct. This is the file from apache2/sites-available
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin xxx#xxxx.xx
ServerName vue.tatrytec.eu
ErrorLog ${APACHE_LOG_DIR}/www/vue.tatrytec.eu/error.log
CustomLog ${APACHE_LOG_DIR}/www/vue.tatrytec.eu/access.log combined
DocumentRoot /var/www/vue.tatrytec.eu/dist
<Directory "/var/www/vue.tatrytec.eu/dist">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
RewriteEngine on
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</Directory>
SSLCertificateFile /etc/letsencrypt/live/vue.tatrytec.eu/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/vue.tatrytec.eu/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
You have to configure your Apache web server so that it routes all requests to your index.html. See example.
Related
I am actually trying to do 2 things:
1. convert site port from 80 to 3000
2. redirect site from example.com to www.example.com
My machine is amazon linux, so using http
so in httpd.conf file, below is what I've added:
<VirtualHost *:80>
ServerAdmin admin#example.com
ServerName example.com
ProxyPreserveHost On
RewriteCond "%{HTTP_HOST}" "!^www\." [NC]
RewriteCond "%{HTTP_HOST}" "!^$"
RewriteRule "^/?(.*)" "http://www.%{HTTP_HOST}/$1" [L,R,NE]
# setup the proxy
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
</VirtualHost>
In above, port changing is working, but redirecting to www not working, could you please suggest me what changes I need to make, to make it to work in above.
I have a white-label web app that runs with subdomains to divide out the labels. Let's say cust1.app.com and cust2.app.com. I have SSL on my site, but I am having troubles making the site redirect from http to https. I want to do this all within http.conf, as opposed to .htaccess files. Here is my http.conf:
<VirtualHost *:443>
<Directory /var/www/html/>
Options -Indexes
Require all granted
AllowOverride All
</Directory>
ServerAlias *.app.com
DocumentRoot /var/www/app
SSLEngine on
SSLCertificateFile /var/www/certs/cert.pem
SSLCertificateKeyFile /var/www/certs/privkey.pem
SSLCertificateChainFile /var/www/certs/fullchain.pem
</VirtualHost>
<VirtualHost *:80>
ServerAlias *.app.com
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{HTTP_HOST}/$1 [R,L]
</VirtualHost>
When visiting http://www.app.com or http://cust1.app.com, I get a simple ERR_CONNECTION_REFUSED, however when I manually put in the https, the site serves fine on all subdomains.
How do I redirect to https while honoring my wildcard subdomains?
Turns out I was missing the Listen directive for port 80, I must have deleted it from ports.conf or something at some point in the long and hair-pulling troubleshooting process. Here's my http.conf now:
Listen 80
Listen 443
<VirtualHost *:443>
<Directory /var/www/html/>
Options -Indexes
Require all granted
AllowOverride All
</Directory>
ServerAlias *.app.com
DocumentRoot /var/www/app
SSLEngine on
SSLCertificateFile /var/www/certs/cert.pem
SSLCertificateKeyFile /var/www/certs/privkey.pem
SSLCertificateChainFile /var/www/certs/fullchain.pem
</VirtualHost>
<VirtualHost *:80>
ServerAlias *.app.com
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{HTTP_HOST}/$1 [R,L]
</VirtualHost>
Below is my Apache config. What I am trying to do have a reverse proxy set up for the main part of the site. So when users go to mysite.xyz, they get what is running on port 5000 (this is working). I also want to run a flask app on mysite.xyz/page1 This is coming back with a 404 not found page. When I switch them and put the app at / and put the main site at page1, then the app works but page1 can't find any of the correct js assets so I'd like to avoid that. But the app does work and works on apache but the reverse proxy must be over-riding the WSGI deployment of the flask app or something?
<VirtualHost *:80>
ServerName mysite.xyz
ServerAdmin email#gmail.com
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
RewriteCond %{HTTP_HOST} !^mysite\.xyz$ [NC]
RewriteRule ^/$ http://%{HTTP_HOST}/ [L,R=301]
WSGIScriptAlias /page1 /var/www/FlaskApp/FlaskApp.wsgi
<Directory /var/www/FlaskApp/>
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Instead of ProxyPass, try:
RewriteRule ^/$ http://127.0.0.1:5000/ [P]
ProxyPassReverse / http://127.0.0.1:5000/
I know this is stale but it may help someone. Flask hates reverse proxy. You need to add flask-reverse-proxy-fix to your app.
https://pypi.org/project/flask-reverse-proxy-fix/
Currently running site on apache server on ubuntu and now whole site is protected with .htaccess authentication.
Want to do: I need to allow two URL without authentication.
sites1.conf
<VirtualHost *:80>
...
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/(tools|manager)/
</VirtualHost>
<Directory /srv/site1/symfony/>
AuthType Basic
AuthName "My Area"
AuthBasicProvider file
AuthUserFile "/etc/apache2/passwords.htpwd"
Require user user1
SetEnvIf Request_URI ^/en/App/uploadImagesForm allow
Order allow,deny
Allow from env=allow
Satisfy any
</Directory>
URL: xxx.xxxx.xx:9005/en/App/uploadImagesForm/
Problem Still asking password
You can disable authentication for the whole directory
<Directory "/srv/site1/symfony/public">
AuthType None
Require all granted
</Directory>
To allow only specific URI add the following code to your VirtualHost configuration.
<Location "/en/App/uploadImagesForm">
AuthType None
Require all granted
</Location>
Take a look at the Apache Sections Configuration documentation for more details: http://httpd.apache.org/docs/current/sections.html#file-and-web
I have the following in my apache2.conf file for a django project:
#ServerRoot "/etc/apache2"
<VirtualHost *:80>
Alias /static /home/ubuntu/Avails/static
# virtual host configuration
WSGIScriptAlias / home/ubuntu/Avails/wsgi.py
</VirtualHost>
Similar to a previous question I asked here (How to redirect one domain to another).
I have two domains:
www.new.example1.com/ --> IP=1.2.3.4
www.new.example2.com/ --> IP=1.2.3.4 (same IP for both domains)
I want all requests that go to www.example2.com/* to access the requested page. I want all requests that go to www.example1.com/* to redirect to www.example2.com/*. how would I redirect a domain within the VirtualHost block, instead of using the .htaccess file?
Here is what worked. Special thanks to anubhava for the help:
1) Enable module rewrite:
$ sudo a2enmod rewrite
2) Edit apache2.conf file:
<VirtualHost *:80>
Alias /static /home/ubuntu/Avails/static
# virtual host configuration
WSGIScriptAlias / home/ubuntu/Avails/wsgi.py
RewriteEngine On
RewriteCond %{HTTP_HOST} ^new\.example1\.net [NC]
RewriteRule ^ http://new.example2.net%{REQUEST_URI} [NE,R=301,L]
</VirtualHost>
3) Restart apache:
$ sudo service apache2 restart