WordPress的子目录apache2没有浏览索引和.htaccess

对不起,如果这之前已经问过,但我通过其他职位看,无法find我的答案。

WordPress的启动和运行在/ var / www / wordpress /然而,当我浏览到www.mysite.com我得到的文件和文件夹列表如下:

指数 /

Name Last modified Size Description index.html 12-Mar-2013 18:31 177 wordpress/ 08-Jan-2012 17:01 - 

Apache / 2.2.22(Ubuntu)服务器在www.mysite.com端口80

如果我点击wordpress目录,我被带到我的网站。

我问了一个朋友,他说修改.htaccess但没有这样的名称在/ var / www /

我如何获得apache将我的默认主页/目录设置为/var/www/wordpress/(index.php)?

我试着取消注释ServerRoot“/ var / www / wordpress”

但是,这导致尝试重新启动Apache的错误: – 无法findports.conf – 无法findconf.d事情从那里走下坡…

我是否修改网站 – 可用/默认?

我修改apache.conf?

我添加一个.htaccess文件?

此外,由于这是一个新的设置,我如何确保安装,我读了很多人使用特制的.htaccess文件?

谢谢你的帮助!

网站的内容 – 可用/ wordpress:

 <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/wordpress/ <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/wordpress/> Options Indexes FollowSymLinks MultiViews AllowOverride None 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 </VirtualHost> 

网站内容 – 可用/默认:

 <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/ <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None 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 </VirtualHost> 

启用网站的内容:

 [email protected]:/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 

您需要将ServerName指令添加到您的VirtualHosts,以便您的Web服务器将知道如何路由请求。 另外,请确保在进行configuration更改后重新启动Web服务器。

另请注意,根据您的情况,您可能还需要将ServerAlias指令添加到一个或多个VirtualHost。

在这里看到更多的信息:

基于名称的虚拟主机支持

你只想主办一个网站(一个WordPress站点)? 您可以添加一个.htaccess文件来redirect,也可以使用apache中的虚拟主机设置来指向yoursite / wordpress作为文档根目录。 有很多方法可以做到这一点。 当你安装wordpres时,它应该有一个.htaccess文件,我想。 如果您使用的是.htaccess,您需要在您的httpd.conf / apache.conf的wordpress部分中使用allow override指令。 也许你可以把你的wordpress文件夹的内容转储到你当前的文档根目录下。 要么w

查看此链接http://wiki.cnic.edu.cu/index.php/Adicionar_sitio_web_al_apache

这是我在apache2“wordpress.conf”中的configuration:

 Alias / /var/www/wordpress Options FollowSymLinks #DirectoryIndex index.php Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all