Install/Configure and run HTML pre-render service on CentOS

To serve javascript rendered page as html page  to search engine crawlers so that our site becomes SEO friendly, we can use node server like prerender.We configure and run prerender server by using this .sh script:
    1. #install nodejs(Run "yum clean all && rpm --rebuilddb && yum update" in case yum cant find them)
    2. yum install nodejs
    3. #install nodejs,s npm utility
    4. yum install npm
    5. #install Font configuration and customization library
    6. yum install fontconfig-2.8.0-3.el6.i686
    7. cd /usr/local/
    8. #download prerender server
    9. git clone https://github.com/collectiveip/prerender.git
    10. cd prerender/
    11. #build and install
    12. npm install
    13. #create runner and log file
    14. echo "node server.js >> \"prerender_log.txt\"" >> prerender_runner.sh
    15. #set to run at startup
    16. echo "nohup /usr/local/prerender/prerender_runner.sh &" >> /etc/rc.local
    17. #start prerender
    18. sh prerender_runner.sh &
    19. #check output from prerender server
    20. tail -f prerender_log.txt
Do all this by using this Script to download,configure & run prerender server.
By default it starts on port 3000.So you will find it at : localhost:3000
To test if it successfully installed simply browse to this url:
http://localhost:3000/http://www.facebook.com

Right click on document and click view page source.You won't find any javascript there cause the page comes after all javascripts are executed.
Be careful about url syntax.Omitting protocol(http/https) and www will not work.Like these urls will not work:
http://localhost:3000/www.facebook.com
http://localhost:3000/http://facebook.com


Related:-
Making javascript heavy sites crawlable / SEO with Prerender.IO / Getting started with Prerender.io for java sites
Running web application & prerender node server on same machine

No comments:

Post a Comment