Laravel Valet with Apache + dnsmasq - apache

I have Laravel Valet installed and configured to .loc domain (was working just fine)
Then I needed Apache server alongside with Laravel Valet, so I followed these instructions: https://getgrav.org/blog/macos-mojave-apache-mysql-vhost-apc
I configured Apache to serve .test domains. After I was done with instructions above, .test domains started working, but sites served by Laravel Valet (.loc) stopped working.
When I open any .loc site it loads localhost page (served by Apache).
My virtual hosts: /usr/local/etc/httpd/extra/httpd-vhosts.conf file:
<VirtualHost *:80>
DocumentRoot "/Users/daiyrbek/Sites"
ServerName localhost
</VirtualHost>
# and few other exact hosts like: site1.test -> ~/Sites/site1
What I want is:
.loc should be served by Laravel Valet
.test should be served by Apache
My /usr/local/etc/dnsmasq.conf file:
address=/.test/127.0.0.1
conf-file=/Users/daiyrbek/.config/valet/dnsmasq.conf
/Users/daiyrbek/.config/valet/dnsmasq.conf file:
address=/.loc/127.0.0.1
listen-address=127.0.0.1
How to work around this?

Basically it's not possible to achieve what I am trying to do as Laravel Valet's requirements are:
Valet requires macOS and Homebrew. Before installation, you should make sure that no other programs such as Apache or Nginx are binding to your local machine's port 80.
https://laravel.com/docs/6.x/valet#installation

Related

CSS & images breaking after mapping application deployed on Tomcat to my domain

I've installed Tomcat 9.0.27 on my Digital Ocean droplet running Ubuntu 18.04.3.
I deployed my Java WAR on Tomcat and am able to access it on the URL:
http://example.com:8080/app_name
I want to be able to directly access my WAR serving JSP through my domain.
So, when I hit example.com it directly serves my Java application.
I have tried several links to do the same. According to one of them (https://www.digitalocean.com/community/questions/how-to-tie-domain-name-with-application-running-on-tomcat), I did the following steps:
1. Enabled "proxy" and "proxy_http" using a2enmod
2. Restarted Apache2 service using systemctl restart
3. Created a new virtual host in a file named /etc/apache2/sites-available/tomcat.conf with the following contents:
<VirtualHost *:80>
ServerName www.example.com
ProxyRequests On
ProxyPass / http://localhost:8080/app_name/
ProxyPassReverse / http://localhost:8080/app_name/
</VirtualHost>
Enabled 'tomcat' site using a2ensite
Restarted Apache2 service using systemctl restart
Now when I hit example.com it does serve my homepage but all the CSS styles and images seem to be broken. The hyperlinks also don't work anymore.
My application is still being served at example.com:8080/app_name and on this URL everything works perfectly.
Please help me out with this.
Fixed this by renaming my webapp to "ROOT" and copying it to Tomcat.
Now the redirection is to http://localhost:8080.

Wildfly, Tomcat, Apache and Subdomains

I have an Ubuntu server in AWS that is running multiple application servers -- a Wildfly serving up some pages and two Tomcats running a separate app.
I am trying to get subdomains working.
I have DNS's set up to point subdomain1.example.com, subdomain2.example.com. That works fine.
Wildfly is listening on port 80 (I think?), the Tomcats are listening on 8080 and 8090. The goal is to have www.example.com go to Wildfly, subdomain1.example.com go to Tomcat : 8080 and subdomain2.example.com go to Tomcat : 8090
I've found numerous posts that talk about setting up virtual hosts in Apache that should solve my problem. But I keep getting sent down rabbit holes. Some suggest adding to /opt/bitnami/apache2/bin/httpd.config and some suggest putting it in /opt/bitnami/apache2/sites-available/subdomain1.example.com.conf
My first issue: I don't think that Apache is even running. I was under the impression that Apache was baked into Wildfly, but when I execute:
service apache2 status
I get:
apache2.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
Running sudo service --status-all also doesn't show it running so I think that it is not. It seems to be installed (Bitnami stack) in /opt/bitnami/apache2
Do I have to turn Apache on as part of Wildfly (and how to turn it on)? If I do, then I would assume that Wildfly is no longer getting traffic.
Second - my research tells me I need i need to enable proxy and proxy_http using a2enmod and a2ensite but I don't have these. Research suggests that all Ubuntu's will have those scripts... do they get created if I turn on Apache?
Sorry for all the noob questions.... I'm a developer without a DevOps guy. This seems like it would so common it would be baked in or there would be a definite solution that I am probably missing.
For those looking for something similar, here is the solution that worked for me.
My server is a Wildfly-Apache2-MySQL AMI image on AWS. I did not need to use a2enmod nor a2ensite as my research suggested. It seems many of those modules are already enabled by the pre-built image.
NOTE THESE INSTRUCTIONS ARE BITNAMI AWI SPECIFIC - YOUR FLAVOR CONFIGURATION MAY BE SLIGHTLY DIFFERENT
To have a subdomain point to a simple Apache text site (yada.example.com):
Create a directory in ~/stack/apache2/htdocs called yada
Add an entry to the virtual hosts configuration file (sudo nano /opt/bitnami/apache2/conf/extra/httpd-vhosts.conf)
<VirtualHost *:80>
ServerAdmin info#example.com
DocumentRoot "/opt/bitnami/apache2/htdocs/yada"
ServerName yada.example.com
ErrorLog "logs/yada-subdomain-error-log"
CustomLog "logs/yada-subdomain-access-log" common
</VirtualHost>
Modify the Apache configuration file to include the virtual hosts. (sudo nano /opt/bitnami/apache2/conf/httpd.conf):
...snip...
# Supplemental configuration
#
# The configuration files in the conf/extra/ directory can be
# included to add extra features or to modify the default configuration of
# the server, or you may simply copy their contents here and change as
# necessary.
...snip...
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
# ADDED THE ABOVE LINE
...snip...
Restart Apache (sudo /opt/bitnami/ctlscript.sh restart apache)
To make it point to a Tomcat server, add this to the httpd-vhosts.conf:
<VirtualHost *:80>
ServerAdmin info#example.com
ServerName yada.example.com
ProxyPreserveHost On
# setup the proxy
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
ProxyPass / http://localhost:8090/
ProxyPassReverse / http://localhost:8090/
</VirtualHost>
Your port may differ.
FYI, I found this helpful: https://docs.bitnami.com/virtual-machine/components/apache/#how-to-configure-your-web-application-to-use-a-virtual-host
Good luck and shout out to #stdunbar for his guidance.

Apache httpd.conf - route request to different port

I have a CentOs 7.1 with Apache httpd running on port 9000.
So if i type in my browser: http://192.168.56.101:9000/ I see the Apache Testing 123 Page.
I also have a GitLab Server running on port 8888, but this port is closed by the firewall.
I want that Apache redirects traffic to http://192.168.56.101:9000/gitlab internally to the GitLab server.
I have done this in my Apache config file /etc/httpd/conf/httpd.conf:
<VirtualHost *:9000>
ProxyPass /gitlab http://192.168.56.101:8888/users/sign_in
ProxyPassReverse /gitlab http://192.168.56.101:8888/users/sign_in
</VirtualHost>
When users browse to http://192.168.56.101:9000/gitlab the login page appears (css seems broken though), but when logging in this appears:
Not Found
The requested URL /users/sign_in was not found on this server.
Is this something that is configurable with Apache and if so how?
Do I need to use some sort of Url-Rewriting, if yes which and how to get started?
All the links in gitlab will presume you are pointing at the original server.
So you need to look at mod_proxy_html to also replace these links in the HTML:
https://httpd.apache.org/docs/2.4/mod/mod_proxy_html.html

Cannot connect from network to ubuntu lamp magento install

Hi Apologies if this has been posted below but I cannot seem to find a solution.
I have installed lamp server with ubuntu 14.04 and cannot connect to my magento install from my local network.
I also have joomla installed and it works fine when accessed from the network so I don’t think it is an issue with ports or firewalls. As far as i know i did not select ssh at the magento install.
I need this to work so that I can see how my website displays on mobile devices.
The following setting are set in my /etc/apache2/sites-enabled/000-default.conf:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
It must be magento specific - as it works in joomla. Not sure if this is relevant but I do not have a .htaccess file in my magento directory.
also it works fine when accessed from the machine where the apache2 server is insatlled for joomla and magento. I have added port forwarding for ports 80, 443 and 8888 on my router to the machine with lamp server.
Try changing entry from localhost to your ip address in magento admin system》configuration 》Web for secure and unsecure url. Your configuration for apache is okay you just have the url rewritten when you access your site.

Virtualhosts Configuration in Apache/Resin (running Adobe Coldfusion8)

I have development server setup running Adobe Coldfusion8 (.war install) on top of Caucho Resin v3.1.9. (CentOS 5.3-64bit)
note: This is my first experience with Resin. I am trying to run Coldfusion8 on top of Resin as I was suggested that this would give me great performance gains.
My question is: how I can easily integrate multiple apache virtualhosts like my existing configuration.
On my production server, running CF8, standalone install on Adobe supplied JRun via mod_jrun22.so in apache, I have virtual hosts setup for each of my websites pointing to '/var/www/*/html/, similar to the following (simplified):
<VirtualHost 127.0.0.1:80>
DocumentRoot /var/www/www.mydomain.com/html
ServerName www.mydomain.com
ServerAlias mydomain.com
</VirtualHost>
<VirtualHost 127.0.0.1:80>
DocumentRoot /var/www/www.myotherdomain.com/html
ServerName www.myotherdomain.com
ServerAlias myotherdomain.com
</VirtualHost>
This configuration allows me to setup virtual hosts through apache pointing to '/var/www/*/html' so I can quickly deploy websites with Coldfusion Apps.
Well with Resin, it appears I have to also setup <host> tags for each one of my virtual hosts in '/opt/resin/conf/resin.conf'. Thus, having to completely duplicate apache virtual hosts.
What I really want is to be able to setup my apache virtual hosts and then have resin compensate accordingly.
I need a better solution and am completely open to entertaining any suggestion.
In the resin docs it shows an example using regex to change the root directory. Could you create a similar regex that just caught any .com site and set the document root?
From playing with resin/railo and caucho I couldn't find a way at all to just have the virtualhost configuration in apache only. You have to duplicate it to some level anyway. Either by a regex entry or as I did (only had about 10 domains) create a entry for each site.