server {
listen 80;
server_name www.phpjx.com;
server_tokens off;
root /var/www/html/phpjx;
autoindex off;
access_log /var/www/html/phpjx/logs/access.log;
error_log /var/www/html/phpjx/logs/error.log;
location / {
allow 180.97.80.102;
allow 127.0.0.1;
allow 58.39.194.158;
allow 116.226.46.24;
deny all;
root /var/www/html/phpjx;
index index.html index.php index.htm;
#rewrite ^/(\w+)/(.*)$ /$1/index.php last;
rewrite ^/index.html$ /index.php last;
rewrite ^/product.html$ /index.php?c=index&m=show&classid=2 last;
rewrite ^/product_(\d*).html$ /index.php?c=index&m=show&classid=2&id=$1 last;
rewrite ^/hr.html$ /index.php?c=index&m=show&classid=5 last;
rewrite ^/hr_(\d*).html$ /index.php?c=index&m=show&classid=5&id=$1 last;
rewrite ^/aboutus.html$ /index.php?c=index&m=show&classid=4 last;
rewrite ^/news.html$ /index.php?c=index&m=show&classid=3 last;
rewrite ^/news_(\d*).html$ /index.php?c=index&m=show&classid=3&id=$1 last;
rewrite ^/contactus.html$ /index.php?c=index&m=show&classid=6 last;
}
error_page 404 /404.html;
location = /404.html {
root /var/www/html/phpjx;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
root /var/www/html/phpjx;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\. {
deny all;
log_not_found off;
access_log off;
}
location ~ \.log$ {
deny all;
log_not_found off;
access_log off;
}
}
server {
listen 443;
server_name www.phpjx.com;
server_tokens off;
root /var/www/html/phpjx/Upload;
ssl on;
ssl_certificate server.crt; #证书
ssl_certificate_key server.key; #私钥
autoindex off;
access_log /var/www/html/phpjx/Upload/logs/access.log;
error_log /var/www/html/phpjx/Upload/logs/error.log;
location / {
root /var/www/html/phpjx/Upload;
index index.html index.php index.htm;
}
error_page 404 /404.html;
location = /404.html {
root /var/www/html/phpjx/Upload;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
root /var/www/html/phpjx/Upload;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\. {
deny all;
log_not_found off;
access_log off;
}
location ~ \.log$ {
deny all;
log_not_found off;
access_log off;
}
}