Cannot make new host in MAMP Pro 4 because Create button is always disabled - mamp

When I launch MAMP Pro and navigate to the Hosts tab, click on the "+" at the bottom of the list of hosts, the modal has the create button disabled and I cannot complete making a new host.

I figured it out. It seems that a new host must have a folder to contain it. EXAMPLE: username > Sites > ProjectName > ProjectName.dev

I found out that the reason behind of all of this is because of this character "-" and this _.
Do not use this characters in your localhost name.

Related

Using Lucee Server with Command Box problems accessing Server Administration page

I recently downloaded CommandBox to try to set up a Lucee Server. I have a folder called LuceeSever with an Index.cfm page. When I type the command "box server start" it opens a window at this address: http://127.0.0.1:54613 displaying my index.cfm page. Cool.
But I would like to connect a datasource and I would like to do this thorough the server admin panel that everyone else says to use. So when I try to access http://127.0.0.1:54613/lucee/admin/server.cfm I get this screen:
So I created a password.txt file that contains 1 line of plaintext that is the password I wanted to use. So my directory looks like this:
LuceeServer>
index.cfm
password.txt
In which index.cfm and password.txt are at the same level. When I click import file the screen reloads and nothing happens.
I assume I have things set up incorrectly. I've never used commandbox before and I dont really know what I'm doing.
You can bypass this entirely by using CFConfig. You can either specify the adminPassword in your .cfconfig.json file
{
"adminPassword":"myPass"
}
or you can install commandbox-dotenv and set a global .env file that has a cfconfig_adminPassword key.
~/.box.env
# Add environment variables to be loaded into CommandBox when it starts
# Variables are in the form of foo=bar, one per line
cfconfig_adminPassword=myPass
Disclaimer: I am the lead developer of CommandBox and the CFConfig module.
When you run your server with CommandBox, click on its tray icon in the right corner of your desktop, click open and then the server home folder like shown on the image below:
Then navigate to /WEB-INF/lucee-server/context/ and place your password.txt file there. Then go back to lucees server admin page in your browser and click the "import file" button to import the password.txt file.
Your password.txt needs to go in the "root Lucee server directory", which isn't the same as your site's web root (which wouldn't be a very secure place to put it). In CommandBox the location is a bit obscure, but you can find it with the following command:
server info property=serverHomeDirectory

Mamp Pro 4 HTTP and HTTPS

Is it not possible in Mamp Pro 4 to have both http and https? The application I am working on requires both depending on the page.
I must be missing something as it makes no sense when I enable SSL only https works and http then stops working.
I tried going through the http.conf, but really have no idea whats causing this.
I think it just generates the vhost for https only and then removes http. Doesn't even look like you can manually edit it.
Any suggestion would be great.
Well to update my own post and if anyone else has this problem.
The software is currently not capable of this on the same hostname.
According to Mamp support you have to create two hosts with the same name (e.g. sample.app and sample.app.).
Enable one of the "sample.app" hostnames to use SSL
Enable the second host entry "sample.app" to not use SSL. (Don't forget to hold Alt or Option when clicking on +)
Point both to the same directory.
Mamp will highlight this in red, as its warning that you have two of the same hostnames.
So currently this is the only solution I am aware of for this issue.
Hope they resolve this in future updates as a lot of applications, especially ecommerce rely on the ability to switch between http and https.
You can see this on the Mamp Pro documentation here.
I got a simple solution by edit template:
Open Mamp Pro
File > Edit Template > Apache > httpd-ssl.conf
Add these line after
<VirtualHost *:80>
ServerName MAMP_SSLVirtualHost_ServerName_MAMP
MAMP_SSLVirtualHost_ServerAdmin_MAMP
MAMP_SSLVirtualHost_DirectoryIndex_MAMP
DocumentRoot MAMP_SSLVirtualHost_DocumentRoot_MAMP
</VirtualHost>
Mamp Pro 5 in 2020 Update
To tag onto MrDuy's great response, as the Alt Click on the + doesn't seem to work in V5, editing the httpd-ssl.conf template seems to be the way to go.
However MrDuy's answer assumes you're using port 80 for HTTP inside MAMP, which is not the default 8888. Additionally, and I can't speak for MAMP PRO 4 users, the snippet needs to be placed before the MAMP_SSLVirtualHost_iteration_end_MAMP line at the bottom of the file, as obviously this is the end marker that MAMP uses to conduct its iteration of the hosts in the GUI.
TLDR;
Follow the first two steps in MrDuy's answer:
Open MAMP Pro
File > Edit Template > Apache > httpd-ssl.conf
Then, at the bottom of the file, locate the line with MAMP_SSLVirtualHost_iteration_end_MAMP Before this line, paste the following:
<VirtualHost *:8888>
ServerName MAMP_SSLVirtualHost_ServerName_MAMP
MAMP_SSLVirtualHost_ServerAdmin_MAMP
MAMP_SSLVirtualHost_DirectoryIndex_MAMP
DocumentRoot MAMP_SSLVirtualHost_DocumentRoot_MAMP
</VirtualHost>
It would've been niced to use the placeholder markers MAMP uses in it's non SSL config file (MAMP_VirtualHost_IP_MAMP, MAMP_VirtualHost_Port_MAMP etc) but obviously these aren't passed in the file. Which means that if you decide to change the HTTP port, you must also manually update this file.
#MAMP, can't we make this a default? :`(
Cheers!

How do I alter the default URL location of EasyPHP

EasyPHPs homepage is accessed from : http://127.0.0.1/home/.
Virtual Host manager sets a local domain name to redirect to 127.0.0.1 in the hosts file.
When I navigate to 'mylocaldomain.com/home/' I get an error 'The requested URL was not found on this server.' because '/home/index.php' is used for the Admin Panel of EasyPHP.
I need to use '/home/' in my local domains, so I want to try and change the default URL that EasyPHP homepage is using.
Any ideas?
I just had this problem and ran across your question. This is how you solve it:
Access your EasyPHP Apache config file (on Windows, I right-click on the taskbar icon, go to Configuration, then click Apache)
Look for the line Alias /home "${path}/binaries/home" - Mine was at line 359
Change the first /home to /something-you-won't-think-to-use-on-your-websites
Restart the server
That should do it

dropbox - get an {"error": "Invalid origin"} when i try to upload a file

I was try to upload a file using the Drop box Saver as following:
"https://www.dropbox.com/developers/dropins/saver"
I see the Drop box saver button and when I'm clicking on it I get an error: {"error": "Invalid origin"} in a popup...
I also added to the "Drop-ins domains the local host ip,127.0.0.1
In the popup window that open when clicking on the button there is the uri:
https://www.dropbox.com/saver?origin=file%3A%2F%2F&app_key=undefined&version=2
Maybe the problem is that after the word "file" there are the following characters %3A%2F%2F and there is no file name or location...
app_key is undefine although i added it
What can i do?
It looks like you're opening your HTML directly from the file system instead of running a web server. I believe you'll need to actually run a web server (could be as simple as python -m SimpleHTTPServer) so the URL in the address bar starts with http (or https) and has a domain.

How can I redirect ports in Cherokee?

I've installed cherokee and am very happy with it. But now I'm wondering how I can redirect ports. I'd like to redirect port 80 to other ports based on the hostname, as follows:
Request for http://a.mysite.com to http://mysite.com:8000
Request for http://b.mysite.com to http://mysite.com:9000
All help is appreciated.
Thanks a lot!
Good! Found out myself! :)
To redirect http://a.mysite.com to http://mysite.com:8000 follow these steps in the cherokee admin web environment:
First create a virtual server with name a.mysite.com and give it a document root, e.g. /var/www/a.
Then link to the sources tab and create a new information source by clicking the 'plus' icon. Enter a.mysite.com as nick and mysite:8000 as connection.
Go back to the vServers tab. After making sure that the a.mysite.com server is selected check that the host match method is set to 'match nickname'.
In the behaviour tab select the 'default' directory and in the handler tab select 'HTTP Reverse Proxy' from the handler dropdown list. Then select 'Round Robin' as balancer in the Back-end Server section.
In the section Assign Information Sources section select a.mysite.com as application server.
Then save and restart Cherokee.
You can preform the same process for b.mysite.com.
Or, when your site becomes more popular, you can add more application servers to a.mysite.com .