Wordpress永久链接没有在aws上工作

时间:2015-02-26 12:44:40

标签: wordpress apache amazon-web-services permalinks httpd.conf

我花了4-5个小时来解决它但却无法解决它。

我已经在AWS上设置了我的wordpress网站。除了wordpress的永久链接外,其余的都在工作。

当永久链接设置为默认页面/帖子正在运行但不能使用“%post-name%”时。

我通过谷歌搜索几乎所有的事情但没有成功。

我看到很多与 httpd.conf 文件相关的解决方案,但在我的root上没有文件httpd.conf也没有http目录。

我在 apache.conf 文件中更改了以下代码,但仍无法正常工作

<Directory />
    Options FollowSymLinks
    AllowOverride All
    Require all denied
</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

一次又一次重启apache但没有运气。

请帮帮我们。

感谢。

2 个答案:

答案 0 :(得分:3)

我刚刚设法解决了这个错误。 确保在进行httpd.conf更改后重新启动Apache服务!

此处的文档列出了在AWS上获得wordpress工作所需的所有更改清单 - 包括获取权限更正:http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html

你需要为固定链接修复的位是tp 更新httpd.conf文件

(1)位置:/etc/httpd/conf/httpd.conf

(2)找到以 public class Server { private static ServerSocket serverSocket; private final static Logger LOGGER = Logger.getLogger(Server.class.getName()); public static void main(String[] args) { FileHandler fileHandler = null; int port = 3000; try{ fileHandler = new FileHandler("/home/client/ServerLog.txt"); //fileHandler = new FileHandler("d:/ServerLog.txt"); LOGGER.addHandler(fileHandler); LOGGER.info("Server Started"); serverSocket = new ServerSocket(port); LOGGER.info("Waiting for Connection...!"); while(true) { Socket server = serverSocket.accept(); System.out.println("Connected to : "+server.getRemoteSocketAddress()); ReadThread hldcon = new ReadThread(server); Thread t1 = new Thread(hldcon); t1.start(); } }catch(SocketException e) { System.out.println(e.getMessage()); try { System.out.println("Server Exception...!"); Thread.sleep(10000); } catch (InterruptedException e1) { e1.printStackTrace(); } } catch(Exception e) { e.printStackTrace(); } } } public class ReadThread implements Runnable { boolean runflag = true; Socket server; private byte[] bytarrHeader = null; private byte[] bytarrMsg = null; FileHandler fileHandler = null; int msgheaderlength = 2; private final static Logger LOGGER = Logger.getLogger(Server.class.getName()); public ReadThread(Socket serverSocket) { this.server = serverSocket; } public void setArrymsg(byte[] bytarrMsg) { this.bytarrMsg = bytarrMsg; } public byte[] getArrymsg() { return this.bytarrMsg; } @Override public void run() { byte[] bytarrHeader = null; byte[] bytarrMsg = null; bytarrHeader = new byte[msgheaderlength]; InputStream in = null; byte response [] = null; try{ }catch(Exception e) { e.printStackTrace(); } while(runflag) { try{ in = server.getInputStream(); int nRead = in.read(bytarrHeader); if(nRead != -1) { System.out.println("number bytes returned : "+nRead); // reading data and setting in byte format using setArrayMsg method setArrymsg(bytarrMsg); WriteThread wrt = new WriteThread(server,this); // Starting write thread Thread t2 = new Thread(wrt); t2.start(); Thread.sleep(2000); } }catch(SocketException e) { System.out.println("Error...!"); runflag = false; try { server.close(); } catch (IOException e1) { e1.printStackTrace(); } }catch(Exception e) { e.printStackTrace(); runflag = false; } } } } public class WriteThread implements Runnable { Socket server; ReadThread rd; //responseData = new ResponseData(); public WriteThread(Socket server,ReadThread rd) { super(); this.server = server; this.rd = rd; } @Override public void run() { try{ byte[] bytarrMsg = rd.getArrymsg(); OutputStream out = server.getOutputStream(); out.write(bytarrMsg); }catch(Exception e) { System.out.println("Exception : "+e.getMessage()); } } }

开头的部分
<Directory "/var/www/html">

更改上一节中的 AllowOverride无行,以阅读 AllowOverride All

注意 此文件中有多个AllowOverride行;请务必更改部分中的行。

<Directory "/var/www/html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
AllowOverride None

#
# Controls who can get stuff from this server.
#
Require all granted

(3)重启Apache服务

答案 1 :(得分:0)

如果你没有太多使用aws的经验,那么我猜它是因为你没有给你的apache授予足够的权限。如果您不知道如何向apache授予权限,则可以在控制台中使用此命令

sudo CHOWN -R apache:apache /var/www/html

完成后,请转到设置页面并保存新设置。