Setting up Programm-o locally - apache

After reading the installation guide for program-o http://blog.program-o.com/documentation-v2/installation/ I was wondering how I would go about doing step 2 locally and installing it without hosting an online server?

Just put your code in htdocs directory (inside xampp instalation directory).
Then You will be able to execute your code by typing 'localhost' in your browser.
Or if you want to use other domain instead of localhost, You have to edit your hosts file.
In Windows7 hosts file is located in:
%systemroot%\system32\drivers\etc
My hosts file for example:
127.0.0.1 domain.com
I can access my code by typing for example 'domain.com' instead of 'localhost'

Related

http://localhost is getting forwarded

I am using Xampp and in my htdocs directoy I have a folder called 'task4u'. If I go to http://localhost, I'll get forwarded to the page of 'task4u' (which is a Symfony 4 application).
In htdocs I have now created a new folder for a new website but I still get forwarded to the directory 'task4u'.
I have checked the windows file 'hosts' but there is nothing related to this issue.
Where could that forwarding be set? Is that because of Symfony itself maybe?
Windows host file contains only a redirect to 127.0.0.1 (loopback address) for "localhost" (or you can configure more redirects to 127.0.0.1).
You have to give a look to httpd.conf Apache file; it should be under this path for a XAMPP installation: C:\XAMPP\apache\conf\httpd.conf. Open httpd.conf with a text editor and change it with your new directory path under DocumentRoot C:/your/path and < Directory C:/your/path/>
Remember to restart Apache server by XAMPP interface.

How to create an Apache Virtual Hosts for a non-local website?

I installed Apache on my local machine. I created 2 Apache virtual hosts with conf files for www.mysite.local and www2.mysite.local. I followed this tutorial : https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts
Now I would like to create a conf file for www.google.com and display a message writing in the index.html file. I followed the same tutorial, I created a index.html file in /var/www/www.google.com/public_html/, I created a file www.google.com.conf in /etc/apache2/sites-available, I edit my local file adding www.google.com on my VPS IP address. But google didn't display the message I want and display an error : "Your connection is not private".
This process doesn't work because it's not a local site? Do you know if there is an other process to configure non local websites?
Thank you!
This is because your browser will have cached that www.google.com has HSTS, so it will only connect to that site with HTTPS. For what you're trying to do, which is to have a faked domain, why not use the explicitly non-real domain example.com?

How to change apache2 127.0.0.1 name from localhost to another domain?

Sorry if this question is stupid, but I am a newbie when it comes to apache and servers in general and I have been trying but I can only find windows only answers. I'm running an apache server on a mint vm. When I type localhost, it redirects to the page automatically, same as doing 127.0.0.1 or 127.0.1.1. Now, I want to change this to another domain name, but not a website one. Like, I want to change from the word localhost to another word, like 'local'. I have been unable to find answers, I have read about virtual hosts but I don't think that is it because I'm only running one website instance. This is just an example website btw, it's just a index.html file for me to learn how to configure things. I have changed my 000-default.conf to say ServerName thenameIwant but it doesn't work. I noticed it says that this is the last resort host what is the first one?
To be able to use local to connect to your server, you would use local as a domainname which resolves to localhost or 127.0.0.1. You could do this by editing your hosts file. Depending on your os this file is stored in different places. Just google 'Change hosts file [your os]'. And add the following line: local 127.0.0.1.
The default apache server is set to listen for any domain, also local.

How to run my html file with apache2

Maybe it is not a right channel to ask this question but I donot know where to ask.
I want to know how to run html file with apache on my ubuntu. I have written program with javascript and a html file and I want to run it via apache. I could not find htdocs folder in to copy my files there beside that I do not have permission to do that in ubuntu. My apache is installed in /usr/share/apache2.
When I write http://localhost it says:
It works!
This is the default web page for this server.
The web server software is running but no content has been added, yet.
but I do not know where to add the contents.
any help.
The default folder that it serves the HTML files from is /var/www.
For example, /var/www/test.html would be http://localhost/test.html.
In my case where I have installed and running the Apache 2 and if I type localhost/ into the browser it opens the Apache 2 Ubuntu default Page.
Now what I did was:
Suppose your HTML webpage Demo.html is located in the Website directory then copy the HTML page using one of the commands:
:~$ cp ~/Website/Demo.html /var/www/html
If this command does not work then try with the following command:
:~$ sudo cp ~/Website/Demo.html /var/www/html
And then open your browser and type this the browser search bar:
localhost/Demo.html
It will open the copied Demo.html.
Also if you want to access this hosted webpage from the outside of the machine where Apache 2 is running then use it's external IP address instead of localhost as follows:
ExternalIP/Demo.html

PHPMyAdmin and Security on XAMPP not working after changing DocumentRoot in httpd.conf

SUMMARY
I am unable to run localhost/phpadmin and localhost/security after changing the DirectoryRoot in XAMPP httpd.conf. This leads to two questions.
If I am using XAMPP on Windows, is there any way to run PHP files outside the localhost directory that I have set in the httpd.conf?
If "no", then how does one run files such as phpmyadmin or the security module on the local machine, if the phpmyadmin files reside in the c:\xampp directory but the DocumentRoot path in httpd.conf points to a different directory?
More detail is set out below.
BACKGROUND INFO
My installation is as follows.
Operating system: Windows 7
Version of XAMPP: xampp-portable-lite-win32-1.8.1-VC9.7z
Installation directory: c:\xampp-portable
Code files saved in: d:\dropbox\websites_user1\...
I then modified the httpd.conf as follows:
Line 191: DocumentRoot "D:/Dropbox/websites_user1"
Line 222: <Directory "D:/Dropbox/websites_user1">
The default httpd-xampp.conf configuration is unchanged - e.g.:
Line 99: Alias /phpmyadmin "/xampp-portable/phpMyAdmin/"
Line 100: <Directory "/xampp-portable/phpMyAdmin">
Line 121: <LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
THE PROBLEM
After changing the directory root in httpd.conf as above, I can run php files successfully from local host - e.g. localhost/project01/demo.php.
However, I now can't run PHP files from any location other than those located in the new localhost directory (i.e. d:/Dropbox/websites_user1/..). This means that I can no longer run PHP files in locations such c:\xampp\PHPMyAdmin or C:\xampp-portable\security\htdocs\security.php.
Also, the configuration for the PHPMyAdmin and Security are clearly no longer correct. For instance, if I enter "localhost/phpmyadmin" or "localhost/security", I get a "page not found" error.
This leads to two sets of questions (as summarised at the start of this question).
Is the directory configured as the localhost the ONLY location from which PHP files can be run? Is it possible to configure PHP to run from any location on my C or D drives?
If not, how do I run files such as those in PHPMyAdmin or security.php or any of the innumerable files in the other xampp directories? Do I need to copy and paste the phpmyadmin folder into my localhost folder at D:/Dropbox/websites_user1? Or into each of the individual website folders beneath that? If yes, do I then need to reconfigure any files such as http-xampp.conf?
I am relatively new to PHP and new to XAMPP. Everything was working perfectly until I ran into this ... and now I'm completely stuck if I can't use PHPMyAdmin, and can't even use the Security module to set my passwords.
Will be very grateful for advice!!
I believe you cant run anything higher than your root as a security feature. Imagine some remote person knowing your IP address and accessing all your files above your document root.