Let say i want to run my php or html or txt page on my local machine
Choose a path, let say /etc/test Now you need to set this path in httpd.conf
$ vim /etc/apache2/httpd.conf
Find "DocumentRoot" , it might be #DocumentRoot "/Library/WebServer/Documents"
uncomment it and make a change like
DocumentRoot "/etc/test"
now save the file and restart the httpd service. run
$ apachectl restart
Create a html file inside /etc/test directory
$echo "It works" > /etc/test/index.html
$ cd /etc/test python -m SimpleHTTPServer 8000
and open your browser and type localhost
To browse or file manager or Index all the files and folders in http directory
enable 'Indexes'
like below in httpd.conf
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
Order deny,allow
Allow from all
and do apache restart
You'll get below error when there is no indexes enabled.
Choose a path, let say /etc/test Now you need to set this path in httpd.conf
$ vim /etc/apache2/httpd.conf
Find "DocumentRoot" , it might be #DocumentRoot "/Library/WebServer/Documents"
uncomment it and make a change like
DocumentRoot "/etc/test"
now save the file and restart the httpd service. run
$ apachectl restart
Create a html file inside /etc/test directory
$echo "It works" > /etc/test/index.html
$ cd /etc/test python -m SimpleHTTPServer 8000
and open your browser and type localhost
To browse or file manager or Index all the files and folders in http directory
enable 'Indexes'
like below in httpd.conf
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride None
Order deny,allow
Allow from all
and do apache restart
Index of /img
Name | Last modified | Size | Description | |
---|---|---|---|---|
Parent Directory | - | |||
logo.png | 14-Feb-2015 00:17 | 9.5K | ||
logo_big.png | 14-Feb-2015 00:17 | 69K | ||
logo_med.png | 14-Feb-2015 00:17 | 22K | ||
You'll get below error when there is no indexes enabled.
No comments:
Post a Comment