Testing website on localhost server for iphone and ipad - iphone

What I'm looking to do is preview what I've built on a custom localhost server (set up with Mamp Pro) on my iphone or ipad. The localhost is under http://devsite:8888 and not http://localhost:8888.
I've tried the instructions for something similar found here. The result was being able to see the files but it was just the list of the files on the server and not picking up index.php—no previews enabled. I've triple checked to make sure I have a proper index in the root directory as well.
Added /etc/apache2/extra/httpd-vhosts.conf file
https://gist.github.com/07223bf788ef1e2e1411

Put this in your .htaccess or httpd.conf (usually /etc/apache2/httpd.conf on OSX):
DirectoryIndex index.php
If that is put in .htaccess be sure that somewhere in httpd.conf (or whatever customm config file for the web server) you have this (replace /var/www/html with the directory where your .htaccess file is):
## These lines can go anywhere in the main config file:
AccessFileName .htaccess
<Directory "/var/www/html">
AllowOverride All
</Directory>
Also, make sure your /etc/hosts file includes:
127.0.0.1 devsite
# Or whatever your local computers IP is:
# 192.164.2.164 devsite
so that the hostname will resolve properly.
Edit:
From the comments, it sounds like your virtual hosts may need additional configuration. Can you put the contents of the /etc/apache2/extra/httpd-vhosts.conf file in your question?

Related

Where will be the myserver.conf, hosts, and ports.conf in cPanel/WHM?

I want to customize my client's site with virtual host block. Manually I did this request on the Ubuntu server 18.04. But now I have the cPanel and the WHM access.
I read these official links.
Modify Apache Virtual Hosts with Include Files
Modify Virtualhost Containers With Include Files
But I messed regrading the include files and those directories as,
/usr/local/apache/conf/userdata/ssl/2_2/$user/$domain/$includename.conf
and
/etc/apache2/conf.d/userdata/ssl/2_4/user/domain/includename.conf
And the following scripts
To rebuild the httpd.conf file, run the following script:
/usr/local/cpanel/scripts/rebuildhttpdconf
To restart Apache, run the following script:
/usr/local/cpanel/scripts/restartsrv_httpd
Please clearly tell how can I merge this to be put using cPanel and WHM.
vhost
<VirtualHost *:9876>
ServerName 139.59.xxx.xxx
DocumentRoot /home/username/newfile/doneapi/public
<Directory /home/username/newfile/doneapi/public>
AllowOverride All
</Directory>
</VirtualHost>
hosts file
127.0.0.1 139.59.xxx.xxx
ports.conf
Listen 9876
Thanks in advance

MAMP Pro /MAMP/ start page not accessible on local network

I am trying to access the MAMP Pro /MAMP/ start page over the local network, but I get the following error in the apache log:
[Wed Feb 24 12:21:03 2016] [error] [client 192.168.1.63] client denied by server configuration: /Library/Application Support/appsolute/MAMP PRO/mamp
I have locally mapped http://dev in my host file to the ip of the server, and I am able to view the websites hosted by MAMP, but not the start page.
Some facts that may be of use to diagnose:
I am using MAMP Pro 3.5
The document root has been changed to ~/Sites
If I run normal MAMP I can access the start page fine from the local
network. This is using the same ports as MAMP Pro, the same
document root, and the same PHP version.
I am under the impression that for some reason MAMP Pro uses a different location for the mamp start page files than that of MAMP? I have found the files in:
/Library/Application Support/appsolute/MAMP PRO/mamp
and
/Applications/MAMP/bin/mamp
and the permissions seem to be the same, as is the user.
Any clues?
Thanks in advance.
Had this in the past, just use IP address of the MAMP Mac.
Sometimes I had to configure the Apache http settings and set my other local IP address in to the ALLOW part.
Greetings,
Peter
#PeterInWiesbaden's answer was helpful in pointing me in the right direction. The issue was that in my (normal) MAMP httpd.conf file I had set all the paths of the MAMP start files to be similar to the following:
Alias /MAMP "/Applications/MAMP/bin/mamp"
<Directory "/Applications/MAMP/bin/mamp">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
but when I edited them in the httpd.conf file directly used by MAMP Pro, these get overwritten each time the server starts, as it uses a template for each Server Name.
To edit httpd.conf for MAMP Pro, it must be done through going to the following in the menu bar:
File->Edit Template->Apache->httpd.conf
And changing the MAMP Pro start pages sections similar to the following:
Alias /MAMP "/Library/Application Support/appsolute/MAMP PRO/mamp"
<Directory "/Library/Application Support/appsolute/MAMP PRO/mamp">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

How to make public directory of my framework the default one in Vagrant?

I am using Vagrant to set up my local development environment. I managed to do port forwarding from port 80 on my Virtual Machine (lucid64) to my host port 8080. If I put an index.html file in my project folder and type 'localhost:8080' in my browser, I see the html page displayed. So far so good.
The thing is I work on a framework which has this directory structure:
app
**public**
vendor
tmp
where the public folder should be the 'root' folder.
So I edited the project.conf file located at /etc/apache2/sites-available in my Virtual Machine to:
<VirtualHost *:80>
DocumentRoot /vagrant/public
</VirtualHost>
(I simply added the '/public' part).
Now when I go to localhost:8080 in my browser, it downloads the index.php file in the public folder instead of displaying it. How can I fix that please?
Is PHP properly installed and enabled in you apache configuration? I don't think this is connected to vagrant.

How to change from localhost to localhost.local in wamp?

I'm using cakephp 2.1 and WAMP for one of my app which is making use of Facebook Connect plugin. Getting an error saying
An error occurred. Please try later
Googled and found this
http://ardentdev.com/no-facebook-connect-cookies-for-localhost-development/
But not coming to know how to chance the settings from localhost to localhost.local for app in WAMP.
First, you need to add a virtual host. To do this, edit the apache configuration file that came with WAMP. This is assuming you're on OSX.
/bin/apache/Apache2.2.17/conf/http.conf
# add the following
<VirtualHost 127.0.0.1>
DocumentRoot "/path/to/project"
ServerName mysite.local
ServerAlias mysite.local
</VirtualHost>
Then, edit your hosts file. Open up the terminal, and run the following (use whatever editor you like, I'm choosing Vi):
$ sudo vi /private/etc/hosts
And add a host to point to our new site.
127.0.0.1 mysite.local
Lastly, restart the WAMP server and you should be able to visit mysite.local in your browser and it will point to your project.

How to create a propper working project with Zend Framework and Wamp 2.2

So i've been at this for 2 days now and i cannot get it to work together.
I have installed Wamp 2.2 in a standard manner at c:\wamp, nothing special.
I downloaded and extracted the Zend Frameworkm folder and placed the folder it in the C:\wamp\library folder.
So it looks like this :
C:\wamp
- www
- ht.acces
- index.php
- bin
- library
- ZendFramework
- bin
- library
- etc.
- logs
- tools
- etc.
Now as instructed i added both the php location and the Zend framework library to the system variable called PATH wich looks like this : ..;C:\wamp\library\ZendFramework\bin\;C:\wamp\bin\php\php5.3.10\;
Now i can open cmd and type zf create project quickstart, i directed it to create the folder in the www. directory of wamp like this :
C:\wamp
- www
- quickstart
- application
- data
- library
- etc
- ht.acces
- index.php
- bin
- library
- ZendFramework
- bin
- library
- etc.
- logs
- tools
- etc.
Now starts the fun part. All the guides around the internet tell me that i should include the location of the library folder inside the ZendFramework folder in the php.ini at the windows version of include_path: "C:\wamp\library\ZendFramework\library".
Now the fun part is that no one mentions exactly wich php.ini file! There are 2 of them as most of you know one in the php directory and one in the apache directory.
And so i come with my first part of my question, wich one do i need?
Wich is soon after followed by part 2, how to propperly set up the virtual host that is supposedly needed to correctly run the zend application in the folder C:\wamp\www\quickstart.
From what i could gather i need to change the file httpd.conf file in the folder C:\wamp\bin\Apache2.2.21\conf\
I need to add something along the lines of
<VirtualHost 127.0.0.1>
ServerName quickstart
DocumentRoot "c:\wamp\www\quickstart\public"
<Directory "c:\wamp\www\quickstart\public">
AllowOveride all
Order Allow,Deny
Allow from all
<\directory>
<\VirtualHost>
Then after doing so i need to change the host file in the directory c:\windows\system32\drivers\etc. However at that point i am completely lost.
My host file looks like this :
--- standard commented wall of text ---
127.0.0.1 localhost
And at this point the only thing i know that seems to get close to it is that i need to add the line :
127.0.0.1 localhost quickstart
Or something along those lines.
So is there anyone out there with experience regarding Zend Framework that could provide me with an answer? It would be much appriciated :)
Björn
-
First I'm pretty sure that the php.ini you need to change for web display is the one in the apache folder. (it's been awhile since I've used WAMP).
Next don't build your vhost in your apache config httpd.conf, do it instead in httpd-vhosts.conf. (you don't want to accidently break apache),
The way you stting your vhost at the moment you url will look like http:quickstart/
these two links will help:
Setup Apache vhost
Zend Server Vhosts
One of the key thing with using vhosts is to remember to redo localhost so it doesn't go away.
With you windows hosts file, remeber it must be edited in admin mode and you can have many hosts on the same number, here is an example:
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
# ::1 localhost
127.0.0.1 iam.local
127.0.0.1 zfcms.local
127.0.0.1 home.local
127.0.0.1 places.local
127.0.0.1 RentAFlat.local
127.0.0.1 zf2-tutorial.local
127.0.0.1 mp3.local
127.0.0.1 quickstart
and an example from httpd-vhosts.conf, note: localhost is the first vhost...This is important.
<VirtualHost *:80>
DocumentRoot "C:\Zend\Apache2/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\www\iam\public"
ServerName iam.local
ErrorLog "C:\Zend\ZendServer\logs\iam.local.log"
<directory "C:\www\iam">
Options Indexes FollowSymlinks
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</directory>
</VirtualHost>
I hope this helps..
Looks like You're missing (first of all)
<VirtualHost 127.0.0.1>
ServerName quickstart
(...)
<\VirtualHost>