PHP page – Ubuntu – How to open one with your browser

Hi, I have problem with how to open php page with your browser, so I just copy and paste things that I find important. If you think you may help me, please comment!! 🙂
I have found that site mentions that you

Use your browser to access the file with your web server’s URL, ending with the /hello.php file reference. When developing locally this URL will be something like http://localhost/hello.php or but this depends on the web server’s configuration. If everything is configured correctly, this file will be parsed by PHP and output will be a html file.

Now, I just figure it out that nginx’s default setting is stored at /etc/nginx/sites-available/default

In case, something goes horrible, I put a copy of the file..

Well, I found a great website although it tells how to start up with apache. I assume that i can apply it to nginx 🙂 here it’s, click.

Alright then, at the startup, when you open http://localhost/index.php, there appears to be a nginx welcome page located at /usr/share/nginx/www/.

If you want to run it with Netbeans, here is a very quick and brief tutorial.
I’ve found an excellent explanation how to setup php environment without using Netbeans, although it’s a tutorial for Netbeans. I was able to manage to use these instructions to build up a working environment without using Netbeans! Just check the site!

It basically says below:

Change ap with username

$ sudo mkdir /usr/share/nginx/www/~ap
$ ln -s /usr/share/nginx/www/~ap /home/ap/public_html
$ sudo chown ap:ap /usr/share/nginx/www/~ap/

Edit the file /etc/rc.local and put the following line above the “exit 0″:

/usr/bin/spawn-fcgi -a -p 9000 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/

Then, uncomment following code at the /etc/nginx/sites-available/default

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
include fastcgi_params;

and restart nginx

sudo /etc/init.d/nginx restart

and it’s over!!

Just create a php file at /usr/share/nginx/www/~ap/ and open it at your browser by typing http://localhost/~ap/website_name.php


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at

%d bloggers like this: