Nginx伪静态规则
ReNginx伪静态规则
/alidata/server/下并无httpd。
以下路径有一个phpwind.conf 不知是否为站点配置文件。
/alidata/server/nginx-1.4.4/conf/vhosts
-------------------------
回 3楼dongshan8的帖子
你好,我找到了server{} 。但伪静态还是没有成功。
server {
listen 80;
server_name localhost;
index index.html index.htm index.php;
root /alidata/www/;
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
#α¾²Ì¬¹æÔò
include /alidata/server/nginx/conf/rewrite/phpwind.conf;
access_log /alidata/log/nginx/access/http.log;
}
-------------------------
ReNginx伪静态规则
我是完全按照这个网站来进行配置的。
help.aliyun.com/knowledge_detail/5973947.html?pos=1
伪静态规则的路径是cd /alidata/server/nginx/conf/rewrite
配置文件的路径是/alidata/server/nginx-1.4.4/conf/vhosts
server {
listen 80;
server_name localhost;
index index.html index.htm index.php;
root /alidata/www/;
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
#α¾²Ì¬¹æÔò
include /alidata/server/nginx/conf/rewrite/wordpress.conf ;
access_log /alidata/log/nginx/access/http.log;
}
-------------------------
ReNginx伪静态规则
rewrite]# vi wordpress.conf
location / {
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}
这次应该是对了,可是403了
-------------------------
回 5楼dongshan8的帖子
我是完全按照这个网站来进行配置的。
help.aliyun.com/knowledge_detail/5973947.html?pos=1
伪静态规则的路径是cd /alidata/server/nginx/conf/rewrite/wordpress.conf
vi wordpress.conf
location / {
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}
配置文件的路径是/alidata/server/nginx-1.4.4/conf/vhosts/phpwind.conf
vi phpwind.conf
server {
listen 80;
server_name localhost;
index index.html index.htm index.php;
root /alidata/www/;
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
#α¾²Ì¬¹æÔò
include /alidata/server/nginx/conf/rewrite/wordpress.conf ;
access_log /alidata/log/nginx/access/http.log;
}
以上设置完成后,由404变成403……
然后更改了一下nginx.conf的设置,把user的www www改为root不知道对不对,请老师指点。
/alidata/server/nginx/conf
vi nginx.conf。
user root;
worker_processes 8;
error_log /alidata/log/nginx/error.log crit;
pid /alidata/server/nginx/logs/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 65535;
events
{
use epoll;
worker_connections 65535;
}
http {
include mime.types;
default_type application/octet-stream;
#charset gb2312;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 8m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
#limit_zone crawler $binary_remote_addr 10m;
log_format '$remote_addr - $remote_user [$time_local] '$request' '
'$status $body_bytes_sent '$http_referer' '
''$http_user_agent' '$http_x_forwarded_for'';
include /alidata/server/nginx/conf/vhosts/*.conf;
}
-------------------------
回 10楼dongshan8的帖子
你好,在网上查了一下可能是的default.conf需要更改,不知是不是这两个的问题
可否贴一下cd /alidata/server/nginx/conf下nginx.conf.default
还有cd /alidata/server/nginx/conf/vhosts/下default.conf.bak
-------------------------
回 12楼dongshan8的帖子
你好,这个设置是没问题的,依旧主页以外403。
会不会是index文件缺失的问题,请问这个文件应该在www目录下的什么位置
-------------------------
回 14楼dongshan8的帖子
^^^^^^^^^^^^^^^^
-------------------------
回 16楼dongshan8的帖子
已解决!非常感谢!
赞0
踩0