set up wildcard subdomain on Ubuntu 18.08 (Laravel/Homestead) - laravel

I'm trying to set up wildcard subdomains for a Laravel project in a Laravel/Homestead enviorement, but cannot figure it out why this does not works.
The local setup was successfull, but cannot make it work on the Ubuntu. I've set up in the nginx conf file the server name:
server_name example.test *.example.test
Restarted the nginx, but after accessing any subdomain, there is no activity in access_log.
how can this be done?

It seems, the best/easiest way to solve this is the vagrant-rubydns plugin:
I hope this will help somebody else.

Related

Windows 10 Magento Local Installation with XAMP problem with Virtual Hosts

I have installed Magento in my personal laptop with XAMP (windows 10) all looks good. Followed the same steps on another laptop and not able to get Magento running.
Found that port 80 is occupied in the new laptop and configured xamp with port 8090, Apache, Phymyadmin and all works good. Following is my configuration for virtual hosts file
<VirtualHost *:8090>
DocumentRoot "C:/M/xampp8.1/htdocs/magento2/pub"
ServerName kumar.magento245.com
</VirtualHost>
<VirtualHost *:8090>
DocumentRoot "C:/M/xampp8.1/htdocs"
ServerName localhost:8090
</VirtualHost>
Following in windows hosts file
127.0.0.1:8090 kumar.magento245.com
XAMP Apache running on port 8090
when i enter kumar.magento245.com gives 404 error
I assure you the rest of the installation is in sync with my earlier laptop (that dont have any service running on port 80 and i dint changed the hosts file)
Kindly please advise what to be done..
Not planning to change/edit the service running on port 80 .
when i enter kumar.magento245.com gives 404 error.. it should got my local magento running ( installed at C:/M/xampp8.1/htdocs/magento2/pub )
I followed a response in the following thread #Raz0rwire and solved my issue.
Set up virtual hosts on Apache (XAMPP, Windows 10)
accessed the url like this kumar.magento245.com:8090 port number at the end..
Welcome to SO #kumar2023,
There could be multiple possibilities for resolving this issue,
in this case, I would prefer the below steps :
Try running Magento with the direct browser URL ie. https://yourmagnetopath/pub and ensure at least my Magento has been installed
correctly
Try removing the default ports and their entries, in my case well I am using ubuntu hence there could be a case of caching if you tried multiple times with the same URL.
Try with the incognito browser or I would prefer a new browser where you haven't tried to run this URL.
Just give a try with the newer domain (again there could be a reason for caching)

How to set up /etc/hosts to access a subfolder like it's a root folder (on a Mac)

I am setting up a new machine. I have it configured to use a Sites folder and localhost to access it. Using Apache, everything installed via Homebrew.
Sites folder
site1
site2
In the browser
localhost/site1/index.html
localhost/site2/index.html
That part works fine.
The problem is that site1 and site2 think localhost is the root folder (which it is) but I want them to think localhost/site1 and localhost/site2 are the root folders for those sites.
Is this something I can do with /etc/hosts or some other trickery?
It turns out this is a combination of /etc/hosts and Apache VirtualHosts. Here are the steps I took:
Establish the directories where you want to serve them from (this will become your DocumentRoot). In my case /Users/myusername/Sites/site1
Edit your /etc/hosts file to include your new "domain name" (this will become your ServerName). In my case site1.com
127.0.0.1 site1.com
::site1.com
Create an Apache Virtual Host ... there are different ways to go about this, but I used Homebrew to install Apache, so for me, there is a file here: /opt/homebrew/etc/httpd/extra/httpd-vhosts.conf. I copied the examples provided using DocumentRoot and ServerName as noted above.
Update this file /opt/homebrew/etc/httpd/httpd.conf to uncomment this line
Include /opt/homebrew/etc/httpd/extra/httpd-vhosts.conf
Restart Apache

Apache 403 Error with HTTP not with HTTPS

I've got a very strange issue with Apache:
I'm running Apache/2.2.22 + with PHP 5.5.27 (dotdeb.org) under Debian 7.8.
I made an upgrade of PHP, I'm not sure if it's related but I restarted Apache and suddenly all HTTP stuff ceased to work, only HTTPS requests are correctly handled, VirtualHost config of port 80 is no more working correctly, it seems like Apache is not getting the right DocumentRoot (403 on / and file not found for subfolders and files) if I use a HTTP URL (OK for HTTPS stuff).
sites-available/default syntax is OK, suexec and open_basedir paths updates didn't help.
It's not related to IP (it's not fail2ban, checked on other devices)
It's not the permissions or an Apache running user problem (I tried everything).
I even uninstalled (purge) and reinstalled libapache2-mod-php5.
Nothing worked.
Any clue ?
Thanks
Ok I figured it out, it's not PHP, it's the virtualhosts I created using Virtualmin, here's the fix:
Disable the NameVirtualHost lines in /etc/apache2/apache2.conf
Replace <VirtualHost XX.XX.XX.XXX:80 [XXXX:XXXX:X:XXXX::]:80> by <VirtualHost *:80> in all /etc/apache2/backup/sites-available/ conf files
Add NameVirtualHost *:80 at the top of /etc/apache2/sites-available/default file

Joomla installation - access denied 403

I can already tell that I'm probably doing something hideously wrong, but I just can't get anything to work or even acknowledge me.
I have a working Joomla 1.5 site on a localhost setup on a lamp stack with Ubuntu (newest everything). I am working on upgrading the site to a newer version. I've followed the steps on the joomla site, which are simple, just extract the zip file on the server, just like I did for 1.5, and then go to the site. I am doing this in a subdirectory I've called upgrade, physically located at /var/www/upgrade/ and when i try to go to localhost/upgrade, I get a "FORBIDDEN" 403. I tried localhost/upgrade/administrator, localhost/index.php, localhost/administrator/index.php, and even localhost/installation/index.php and nothing works.
I went into the installation/ dir and made and saved the configuration.php and .htaccess in upgrade/ to no avail and as a last resort I even did a chmod -R 777 * (yeah I know), restarted apache but nothing changes.
Just to see if it was the install, I dl'd Joomla 3.2 and got the exact same result. All the while my 1.5 site is still happily working.
What am I doing wrong?
You want to setup a Virtual host for the new site. You can do this with either a port or a host.
So if you have your Apache conf setup correctly you can add another Virtual host with something along the lines of.
<VirtualHost *:80>
DocumentRoot /var/www/upgrade
ServerName upgrade.local
</VirtualHost>
You'll also need to add a hosts entry which points to your localhost/IP. Its worth checking out a good guide on setting all this up as theres quite a few steps. The Ubuntu one is pretty good if your on that Distro.
https://help.ubuntu.com/community/ApacheMySQLPHP
Specifically the bit on Virtual Hosts
ServerName means that the server will listen for hosts with that name. So, if you have a host such as upgrade.local pointing to your server then the VirtualHost entry will pick that up and point it to the directory /var/www/upgrade.
In order to point a local host to your server you need to add it to your machines hosts file. To add a new host like upgrade.local (you can call it whatever you want) you edit /etc/hosts and set the IP it points to.
127.0.0.1 upgrade.local
ServerName is not mandatory but I find it better as its easier to organise your local host sites.
The alternative is to do it by port (which means you can avoid having to change the hosts file). You need to listen for the port in this case.
Listen 3000
<VirtualHost *:3000>
DocumentRoot /var/www/upgrade
</VirtualHost>

Can't get my Vhosts back running after Mac OS X Lion upgrade

After upgrading my MacBook Pro to Mac OS X Lion I am not able anymore to get my 'Zend Server' running like before. At first the 'Zend Server' gave me servile errors by starting it from the command line. I fix this by doing a complete new installation of Zend Server.
After this new installation Zend Server runs fine and no problems at all. So now I want to put back my zend projects. I made a backup of my vhost file and put it back, it seems to be Lion didn't touch my host file so I didn't touch either (just checked). I did the follow things;
Put one of my vhosts back in conf/extra/httpd-vhosts.conf (just one to check).
Uncomment the vhost include in conf/httpd.conf
Checked my host file
Restart zend server from command line
After this I still cant reach the project by browsing to http://foo.localhost:10088/
Vhosts
<VirtualHost *:10088>
ServerAdmin my#email.com
SetEnv APPLICATION_ENV "development"
DocumentRoot "/Users/nicky/Zend/workspaces/DefaultWorkspace7/foo/public"
ServerName foo.localhost
ErrorLog "/Users/nicky/Zend/workspaces/foo-log"
CustomLog "/Users/nicky/Zend/workspaces/foo-log" common
</VirtualHost>
Hosts
127.0.0.1 localhost
127.0.0.1 dummy-host.example.com
127.0.0.1 dummy-host2.example.com
127.0.0.1 foo.localhost
I am not sure if this can have effect on the problem, but by restarting zend from the
command line, i get the follow:
MacBook-Pro-van-Nicky-Klaasse:~ nickyklaasse$ sudo /usr/local/zend/bin/zendctl.sh
restarthttpd: Could not reliably determine the server's fully qualified domain name,
using MacBook-Pro-van-Nicky-Klaasse.local for ServerName
Regards,
Nicky
I've had similar problems as well with that. I've been searching around for an answer, found some solutions but none of them seemed to work.
The only thing that finally made it working (not even sure how it actually helped), is going into system preferences -> sharing and enabling web sharing. That is normally starting your apache2 server but I wasn't using the default one, I am running another apache2 process with a different httpd configuration. Anyway, after starting it and stopping it (from the system preferences window), it seemed like it was working.
One thing that could be useful is checking your error_log as well as the access_log in /var/log/apache2/. Check the access_log to see what is the address trying to be resolved. At first, whenever I was making a request on my website through the Virtual Host, in my access log I only had 127.0.0.1 which is incorrect. After it worked, I can see that the requests are www.example.com and not the localhost, showing that the virtual host is indeed working.
Not sure if that will help you, give it a try, paste the access_log and error_log latest lines to see where there could be a problem.

Resources