Created
July 12, 2016 15:02
-
-
Save oschaaf/ed7484a2dd6bd278ad549ddbcf351ed8 to your computer and use it in GitHub Desktop.
absolute path rewriting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Welcome to nginx!</title> | |
<style> | |
body { | |
width: 35em; | |
margin: 0 auto; | |
font-family: Tahoma, Verdana, Arial, sans-serif; | |
} | |
</style> | |
<link rel="stylesheet" type="text/css" href="test.css"/> | |
</head> | |
<body> | |
<h1>Welcome to nginx!</h1> | |
<p>If you see this page, the nginx web server is successfully installed and | |
working. Further configuration is required.</p> | |
<p>For online documentation and support please refer to | |
<a href="http://nginx.org/">nginx.org</a>.<br/> | |
Commercial support is available at | |
<a href="http://nginx.com/">nginx.com</a>.</p> | |
<p><em>Thank you for using nginx.</em></p> | |
</body> | |
</html> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 1; | |
master_process off; | |
daemon off; | |
events { | |
worker_connections 1024; | |
} | |
error_log logs/error.log debug; | |
http { | |
include mime.types; | |
default_type application/octet-stream; | |
sendfile on; | |
keepalive_timeout 65; | |
pagespeed on; | |
pagespeed FileCachePath /tmp/pscdn; | |
server { | |
listen 8050; | |
server_name localhost:8050; | |
pagespeed MapOriginDomain 127.0.0.1:8050 localhost:8050/abckey 127.0.0.1:8050; | |
pagespeed ShardDomain 127.0.0.1:8050 localhost:8050/abckey; | |
#pagespeed MapRewriteDomain localhost:8050/abckey 127.0.0.1:8050; | |
pagespeed EnableFilters rewrite_domains; | |
#pagespeed DisableFilters inline_css; | |
pagespeed RewriteDeadlinePerFlushMs 1000; | |
pagespeed PreserveUrlRelativity off; | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
background-image: url("/test1.jpg"); | |
} | |
/* | |
div { | |
background-image: url("test2.jpg"); | |
}*/ |
example output:
oschaaf@ubuntu:~/code/google/nps-testbuild-flushing⟫ curl 127.0.0.1:8050 http://localhost:8050/abckey/A.test.css.pagespeed.cf.8iK-ILAU7G.css
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>body{width:35em;margin:0 auto;font-family:Tahoma,Verdana,Arial,sans-serif}</style>
<style>body{background-image:url(http://localhost:8050/abckey/test1.jpg.pagespeed.ce.C__ndPEfe3.jpg)}</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
body{background-image:url(http://localhost:8050/test1.jpg.pagespeed.ce.C__ndPEfe3.jpg)}
-edit-:
The optimized css looks like:
body{background-image:url(http://localhost:8050/test1.jpg.pagespeed.ce.C__ndPEfe3.jpg)}
I think it should have looked like:
body{background-image:url(http://localhost:8050/abckey/test1.jpg.pagespeed.ce.C__ndPEfe3.jpg)}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
curl 127.0.0.1:8050 http://localhost:8050/abckey/A.test.css.pagespeed.cf.8iK-ILAU7G.css