我刚刚得到一个新的服务器,并想尝试一些其他的事情。 像Nginx而不是Apache。
于是,安装了nginx ,得到了欢迎页面,安装了php5-fpm并下载了一个Wordpress来试试。
但是,当我试图去的地址,我仍然有一个403 Forbidden
这里是conf文件:
server { listen 80; server_name localhost; access_log /var/log/nginx/axiol.access.log; error_log /var/log/nginx/axiol.error.log error; root /usr/share/nginx/axiol; location ~ .php$ { fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/axiol$fastcgi_script_name; include fastcgi_params; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_intercept_errors on; fastcgi_ignore_client_abort off; fastcgi_connect_timeout 60; fastcgi_send_timeout 180; fastcgi_read_timeout 180; fastcgi_buffer_size 128k; fastcgi_buffers 4 256k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; } rewrite /wp-admin$ $scheme://$host$uri/ permanent; try_files $uri $uri/ /index.php?$args; }
我已经检查了axiol文件夹的chmod。
任何想法 ?
你在php的位置犯了一个错误。 你需要逃避 因为它用在正则expression式中。
location ~ \.php$ {
编辑:
您还应该在server添加以下内容:
index index.html index.htm index.php;
如果没有指定文件,这是自动传递index.php(如果index.html和index.htm不存在)所必需的。
检查服务运行的用户和组,并确保它已经读取了文件,并在nginx文件夹的目录下执行。
您可以通过执行以下命令来查看nginx服务正在运行的用户,并查看第一列:
ps aux | grep nginx
(这些权限非常严格,但安全)
find /usr/share/nginx/ -type f | xargs chmod 444 find /usr/share/nginx/ -type d | xargs chmod 555