Friday, May 29, 2015

apache 2.2 - wordpress in subdirectory apache2 without browse index and .htaccess

Sorry if this has been asked before but I looked through other posts and couldn't find my answer.



Wordpress is up and running inside /var/www/wordpress/
However when I browse to www.mysite.com I get a listing of files & folders like the following:



Index of /



Name    Last modified   Size    Description

index.html 12-Mar-2013 18:31 177
wordpress/ 08-Jan-2012 17:01 -


Apache/2.2.22 (Ubuntu) Server at www.mysite.com Port 80



If I click on the wordpress directory, I am brought to my site.



I asked a friend and he said modify .htaccess but there is no file with such name in /var/www/




How do I get apache to set my default homepage/directory to /var/www/wordpress/(index.php) ?



I tried uncommenting
ServerRoot "/var/www/wordpress"



But this led to errors trying to restart apache:
-cannot find ports.conf
-cannot find conf.d
things went downhill from there...




Do I modify sites-available/default?



Do I modify apache.conf?



Do I add an .htaccess file?



Also, since this is a new setup, how do I secure the installation which I read a lot of people use a specially crafted .htaccess file?



Thanks for your help!




Contents of sites-available/wordpress:




ServerAdmin myemail@gmail.com

DocumentRoot /var/www/wordpress/

Options FollowSymLinks
AllowOverride None



Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all


ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None

Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all


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



Contents of sites-available/default:




ServerAdmin myemail@gmail.com


DocumentRoot /var/www/

Options FollowSymLinks
AllowOverride None


Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all



ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all



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




Contents of sites-enabled:



root@ip-0.0.0.0:/etc/apache2/sites-enabled# ll
drwxr-xr-x 2 root root 4096 Mar 20 19:58 ./
drwxr-xr-x 7 root root 4096 Mar 20 19:29 ../
lrwxrwxrwx 1 root root 26 Mar 12 18:31 000-default -> ../sites-available/default
lrwxrwxrwx 1 root root 28 Mar 20 19:58 wordpress -> ../sites-available/wordpress

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...