How can i create my own custom URL for my website i'm hosting - apache

I have set up an apache server on my computer and I am hosting a website off of it. My url that is accessible via other computers on the network is my ip followed by the file path. For example 192.1.1.1/blog/index
I would like to be able to have users access my website by typing studioblog.com or just http://studioblog. How could i achieve this?
I have tried editing the localhost via /etc/hosts file but to no avail

Related

Open server and "How did you get here?"

I have a project folder and i installed open server. In settings open server in domains i set the domain I needed and the domain folder with a link to my project.
but it is not possible to enter the page after starting the server, writes "How did you get here?
To redirect requests for a local IP address to the local domain you need, create an alias in the program settings.".
In file hosts it is not displayed that the open server is working with the specified server, writes instead "127.0.0.1 localhost".
What could be the problem?

Different virtual hosts for same website but different pages

My web server directory is as follows:
var/www/html/site-part-1
var/www/html/site-part-2
In site-part-1, I have a wordpress installation, and when a person lands on my site by google organic / direct whatever when they type in the domain into addres bar it will take user to site-part-1
Currently site-part-1 is operational with the virtual host configuration directory root directory set to var/www/html/site-part-1
But I have a completely different system in site-part-2, that is built with python which I will be accessing via a link from the wordpress site.
example.com (site-part-1) will have a link, and it will take the user to my website example.com/my/directory and in /my/directory will be the contents of site-part-2
It may have worked sticking site-part-2 in the wordpress site folder but for cleanliness I put it into seperate folder
Does anyone know how I should go about setting up my apache settings so that both directories work together?

Apache - hosts file point subdomain

I have a site I developed locally for a client. They have an existing live site (at www.livesite.com). I want to move the developed site to their server, but I want to test it on their server before it's live.
I thought I'd install the site in a sub directory on their server (www.livesite.com/dev), and then using my hosts file, make my browser think it's viewing the final live URL (www.livesite.com).
However, I've tried various combination of things in my hosts file, and I can't seem to get it to work. The server ip followed by the domain / sub-domain.
I'm running on MAMP on OSX. Anyone have experience with this?

Access my MAMP websites (plural) locally from my iphone

I have created a few websites locally on my mac using MAMP PRO as my local server environment.
I can access these on my mac as I have the opion of adding a local domain (in MAMP PRO) using "local name resolution"
But... I don't know how to access my sites from my iphone which I need to do to test.
If I put my local IP in (on my iphone) I get the MAMP holding page:
The virtual host was set up successfully.
If you can see this page, your new virtual host was set up
successfully. Now, web contents can be added and this placeholder
page1 should be replaced or deleted.
Server name: localhost Document-Root: /Applications/MAMP/htdocs
So I know that works but how do I access my indevidual sites.
The location and structure of my sites are like this:
/Users/myusername/Sites/vhosts/site1/public_html
/Users/myusername/Sites/vhosts/site2/public_html
/Users/myusername/Sites/vhosts/site3/public_html
/Users/myusername/Sites/vhosts/site4/public_html
Could this be to do with the localhost Document-Root? I noticed it was /Applications/MAMP/htdocs
Should I change that or change the location of my sites to be in /Applications/MAMP/htdocs?
Thanks
C
UPDATE:
Ok, so I changed my Document-Root to /Users/myusername/Sites/vhosts/ which now allows me to load the site localy in my browser with 192.168.1.134/site1/public_html
BUT.. when I load 192.168.1.134/site1/public_html from my iphone (on the same wifi network) I get the page title but the page doesn't load. Just hangs!
I use ngrok to forward my localhost and would recommend it. After installing it (it's free), you essentially run something like "ngrok 80" and ngrok will create a public URL that can be accessed from anywhere (AKA your phone) and displays the same content that http://localhost/ would.
Apologies I can't post full http:// links- I'm limited by my reputation.
In your example, ngrok might create a domain "hs673gs.ngrok.com" that corresponds to "localhost" when accessed from your local machine. Going to "hs673gs.ngrok.com/site1/public_html" from your iPhone will be essentially the same as visiting "192.168.1.134/site1/public_html" on your local machine.
Hope this helps.
MAMP has launched an app where you can see your local websites on your mobile through their app MAMP Viewer: https://itunes.apple.com/de/app/mamp-viewer/id1047237620?l=en&mt=8
You just configure the host that you want to use for MAMP Viewer:
Select the host you want to view on MAMP Viewer > On General tab, make sure to check, "for 'MAMP Viewer' (LAN only)" > click save > restart your servers > open the app and check your sites.

Browsing sites with their domain name from the same server they are hosted on

I have a co-located webserver(Win2k8) having a public IP and have hosted my ASP.NET website on the IIS. Though, I am able to browse everything else from the local browser(IE) installed on the server, the server somehow fails to browse the websites that are hosted in its own IIS when I access them using their 'domain name' set as a host header. For e.g: If the website is for "www.mywebsite.com", so naturally I have set the Host header property to "www.mywebsite.com" and when I put "www.mywebsite.com" in my IE address bar it fails to get the request.
Ok, so now why I need to access this website is that, I plan to send a Query parameter to one of the pages from another page of the same website.
Any idea how to get this working? Thanks in advance folks.
It may be trying to reach itself via its public IP address, which it may not be able to route to.
You can try adding a line into your hosts file (C:\Windows\System32\Drivers\Etc\Hosts, or equivalent) as follows:
127.0.0.1 www.mywebsite.com
Which will force it to access it via the loopback adapter.