serving laravel with apache vhost - apache

I followed instructions and added in my httpd-vhost.conf file
<VirtualHost *:80>
ServerName project-laravel-learn.my
DocumentRoot "/srv/http/project-laravel-learn.my/public/"
</VirtualHost>
also added like for other local projects, map in hosts file so that
project-laravel-learn.my goes resolves to 127.0.0.1
http (web user), has all permissions to write and read on that public
folder,
also app/storage is rw- for http,
however, when I visit project-laravel-learn.my I get page saying
Whoops, looks like something went wrong!
What might be the problem? Also how I can get more detailed error message as
this one above isn't that much useful.
Just to add, app was working fine before I moved it to /srv/http/, while developing and using php artisan serve command.
EDIT: Ok it works, I forgot to start my local web server instance, however now routing does not work, I get only homepage, but clicking on any link gives 404 object not found error!?
How to fix that?

Found solution here..
http://www.epigroove.com/blog/laravel-routes-not-working-make-sure-htaccess-is-working
I will leave it for a future reference.

Related

Apache (HTTPD) virtual host entry not working

I am setting up apache on my machine to serve some static content. I am running into the following issue:
The public IP address of my instance is: 54.203.56.245 and the domain which maps to this instance is timelines.co. The DNS propagation has happened long back and when using another server, I am able to successfully access my website like this: http://timelines.co
With HTTPD, I am able to access my website like this: http://54.203.56.245 (you can try it out in your browser). However, I am not able to access it like this: http://timelines.co -- I get a 'timeslines.co refused to connect' error (ERR_CONNECTION_REFUSED).
What could be the reason for this? I have been playing with Virtual Hosts, but to no avail.
This is what my httpd.conf looks like - I have added this at the bottom:
IncludeOptional /etc/httpd/sites-enabled/*.conf
This is what /etc/httpd/sites-enabled looks like:
timelines.co.conf -> /etc/httpd/sites-available/timelines.co.conf
This is what /etc/httpd/sites-available/timelines.co.conf looks like:
<VirtualHost *:80>
ServerName timelines.co
ServerAlias www.timelines.co
DocumentRoot /var/www/timelines.co/html
ErrorLog /var/www/timelines.co/log/error.log
CustomLog /var/www/timelines.co/log/requests.log combined
</VirtualHost>
What am I doing wrong?
Edit 1:
On my local computer, I am able to open the website in Internet Explorer but not in Microsoft Edge and Chrome.
Edit 2:
I cleared all browsing data (everything) on chrome, and now the website is loading on chrome too. I have not cleared things on Edge yet and the website is not loading on Edge.
Edit 3:
I cleared all browsing data (everything) on Edge, and now the website is loading on Edge as well. It seems like some sort of cache issue. Not sure what though. Maybe a clash between DNS lookups stored in browser cache.
Maybe you have something in your HostFile that is blocking or making your browser get the Connection Refused. I checked over your Vhost and it looks correct. Your site actually works for me and I get the Success! The timelines.co virtual host is working!
Also, I checked for your DNS Record timelines.co also and it looks correct also
A records
IPv4 address 54.203.56.245

URL for laravel app on MAMP

I am a total noob at this. Got MAMP, Laravel. My webroot is /Applications/MAMP/htdocs. Normally to hit my laravel application I have to go to:
http://localhost:8080/myapp/public/index.php
What files do I have to configure to be able to access it like this:
http://myapp.com/index.php
I've read docs about adding an entry into my hosts file but when I tried adding the following entry 127.0.0.1 myapp.com I still have to do http://myapp.com/myapp/public/index.php.
What am I missing?
You need to edit your .htdocs file to forward myapp.com to 127.0.0.1 and then set up a DocumentRoot in your httpd.conf file. You can set up multiple redirects if you do it properly.

ProxyHTMLURLMap not rewriting URLs the right way

I have a Web-IRC-Client (The Lounge) running at http://www.example.com:3000/ (no HTTPS) and visiting the link works fine. When I specify the port I can use the Web-Client without any problems. Now, I don't want to type the port every time and that's why I am trying to setup a reverse proxy using Apache2's configuration file. The problem is that the client is loading the assets (CSS, JS, images) from the wrong location. See below for more info. I think ProxyHTMLURLMap is the right way of fixing it, but cannot get it to work. I should also note, that I am redirecting all non-www-http traffic to the www-https version.
<VirtualHost *:443>
[...]
SSLProxyEngine on
ProxyPass /irc http://www.example.com:3000/
ProxyPassReverse /irc http://www.example.com:3000/
ProxyHTMLURLMap http://www.example.com:3000/ /irc
</VirtualHost>
When I visit https://www.example.com/irc I just get the text of the website with my javascript, css, etc. Checking the source code reveals, that it is trying to load the assets from:
https://www.example.com/css/bootstrap.css
Which is wrong. It should, instead, be loading from:
https://www.example.com/irc/css/bootstrap.css
Any advice would be greatly appreciated!
EDIT 1: Some more info: Browsing to the https proxy with a slash at the end (https://www.example.com/irc/) kind of works. The images and CSS get loaded, but the client itself doesn't respond and shows "This is taking longer than it should, there might be connectivity issues." even though everything is up.
EDIT 2: Another user suggested adding ProxyHTMLExtended On, but it didn't help either.
Even though this question is very old, I want to leave this here:
https://serverfault.com/a/685326
Note:
If it's still not working, you might add to your config:
ProxyHTMLEnable On

How do I find out where my root URL is being served from in Apache?

I've recently got a VPS server and it came installed with CentOS, WHM and cPanel. I'm trying to find where the physical folder location the root URL of the server IP is being served. When I go to the root IP in a browser, I get a redirect to "/cgi-sys/defaultwebpage.cgi" with "SORRY!" and some error resolve details.
The server has a web-site running under "/cPanel" and also WHM runs on ":2083".
I'm trying take control of the content served directly at the /, and replace that defaultwebpage.cgi with an index.html.
I've tried httpd -V to check where the httpd.conf, is and then spotted a <VirtualHost *> in that config file, which points to a DocumentRoot of /use/local/apache/htdocs . But if I place index.html in this folder and try to hit it via /index.html, I still get routed to that defaultwebpage.cgi. Can anyone help me understand why its rerouting and not picking up that index.html?
Thanks.
You may want to try /var/www/html, at least that's in Ubuntu
If it's not it, then try going to /etc/apache2/apache2.conf and find the DocumentRoot option.
Hope this helps!

Unable to hit https for certain projects

I have a project in xampp/htdocs/project1
I needed to create another project so I decided to assign them different ports so now,
xampp/htdocs/project1 runs on 8080
and my project2 which is under
C:/release/project2 runs on 7171
I needed to make project2 https , so created ssl certificate and everything is setup in apache too.(listening to 443)
https:/xx.xx.xx.xxx:443/project1/login.php gave error
whereas https:/xx.xx.xx.xxx:443/project2/login.php could be hit.
so i did following change in httpd-ssl.conf,
DocumentRoot "C:/xampp/htdocs" to DocumentRoot "C:/release"
but now i get the error -
Access forbidden!
You don't have permission to access the requested object. It is either
read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
Error 403
This error is given for both,
https:/xx.xx.xx.xxx:443/project1/login.php
and https:/xx.xx.xx.xxx:443/project2/login.php
I thought it was permission problems, but i can still hit these
https:/xx.xx.xx.xxx:8080/project1/login.php
and https:/xx.xx.xx.xxx:7171/project2/login.php
What could be the problem? I am new to website development so could not figure out what I am doing wrong.Is project being under htdocs compulsory for this or assigning of different ports was wrong?
You might have got it working by now,
But It seems like the permissions are not set.
It is not compulsary to have the project under htdocs.Since your project is working on 7171 everything might be fine.
you can try following,
1) for permissions, Check if you have AllowOverride All Order allow,deny Allow from all set in httpd.conf too.Restart the server.
If it still doesnt work,
2) check if http://www.youtube.com/watch?v=ZUAKLUZa-AU can help.