Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would really appreciate it if someone could help me. Please let me know if you need more info in the comments.

My Set Up

I have a windows 7 pc. On it I run a virtual box VM with a ubuntu 12 guest os and LAMP setup. I share files between the two machines using samba from linux to windows and using windows file sharing (Workgroup) the other way round. The vm is set up with a bridged network adapter and can happily serve web pages to my host machine.

I use DHCP reservations on my home wireless router/modem to reserve an ip for the vm and give it a sitename.dev in my windows host file so I can access it at sitename.dev through the browser.

The Problem

So far so good but I have a dev project which needs a lot of mobile template development, now obviously I can use a browser plugin to simulate a mobile device but I would like to be able to see the real thing easily on my phone during development.

So ideally I would like a similar setup on my iphone to my windows setup

Now I'm not great on networking and dont have much experience with web server set up. So when I typed the ip of my virtual box into my iphone i wasnt expecting to see anything. I was pleasantly surprised when my site loaded up. The javascript even seems to be running but the images and css are not happening.

My Question

1) What is happening here, is it something to do with the bridged set up on the vm network?

2)How do I make the sites load properly through my phone

Notes

I've also tried another phone.

The same sites viewed on live servers work fine.


Update

/etc/apache2/sites-enabled/000-default

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

Site Structure:

root folder is /var/www

inside there I have a codeigniter setup:

application/
assets/
   /css
   /js
   /img
system/
uploads/
index.php
.htaccess

OK, I think the problem is that links to images/css are using mysite.dev in their urls, I cant make these paths relative but I could use the site ip instead. My preferred solution however would be to find the equivalent of a hosts file on the iphone so, how can I map an address to a url on the iphone - or can I somehow set up a local dns to resolve the address?

share|improve this question
    
If you try to access your site via IP on the computer, does it still display fine? It may not be an issue with your site, but rather your apache configuration. Can you post the contents of your 000-default in /etc/apache2/sites-enabled/000-default? Also, what does your sites tree look like? do you have the css folder symbolically linked within the root of the site? –  kobaltz Dec 12 '12 at 23:12
    
@kobaltz I have updated my question with the details requested but I think you have made me realise what my problem is. I am using mysite.dev in link urls to images/css - I cant use relative urls because the site is designed to add a static url path to all asset links. So I guess my question is now how do I links that to an ip address on my iphone (similar to hosts file on widows) –  WebweaverD Dec 13 '12 at 14:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.