Archive for the ‘plugin’ tag
wordpress.com, wordpress.org, redirections and LinkedIn
I wanted to change my wordpress.com blog to a self-hosted wordpress blog.
This is the scenario:
- My old blog is lbosque.wordpress.com.
- My new blog is blog.luisbosque.com.
- I would like to keep the indexed information in google, so people that open a old indexed post could actually access the information and not receive a 404 status.
- Wordpress.com doesn’t offer the posibility of add a 301 redirection in their system to put your blog outside of it, which is totally understandable.
So, what I did, is this:
- I added an extra domain (blog.luisbosque.com) in my wordpress.com blog. This costs about 10$/year, which is not much money. What I can do with this, is to set the new domain as a primary domain, so when I try to open http://lbosque.wordpress.com, wordpress redirects the request to http://blog.luisbosque.com. Unfortunatelly this is a 302 Redirection which is not a good thing to Google indexing, but there is no choice.
- Next, I installed the last wordpress.org version in my server and imported all the current blog information. Configured the webserver to use the blog.luisbosque.com domain.
- The next step was to change the blog.luisbosque.com DNS zone to point to my new server instead of doing a CNAME to lbosque.wordpress.com. So now when someone try to open http://lbosque.wordpress.com, wordpress.org redirects it to http://blog.luisbosque.com that is actually hosted on my server. My old blog is still hosted in wordpress.com, but because the redirections is no more visible.
So, now, I have to try to change all of my old blog references and wait to Google have indexed the most part of the new blog. Later, I’ll remove the lbosque.wordpress.com blog.
I found a problem when I changed the URL on the LinkedIn Wordpress plugin. Within this plugin, you have to enter your wordpress blog URL, and the plugin updates the LinkedIn application with the latest blog posts. This is great, but it has a problem when the domain you enter is in a external hosting, but it is also registered as a wordpress.com domain. The plugin tries to search this blog in the wordpress.com database, so if it finds it (in my case, it does it) it stops looking for it in their real server.
The solution I figured out is to use an auxiliar domain, this way:
- I configure in my web server an auxiliar domain, for example blog.luisbosque.es. I configure it so when someone try to open http://blog.luisbosque.es the webserver do a 301 redirection to http://blog.luisbosque.com
- I change the LinkedIn wordpress plugin blog URL to blog.luisbosque.es. This domain is not registered in the wordpress.com database so the plugin tries to fetch the feeds within my server, which actually redirects the request to the final domain blog.luisbosque.com
The result is that the posts title that appears in the wordpress application within LinkedIn belong to the blog.luisbosque.com domain and not to the blog.luisbosque.es auxiliar domain.
This is not the cleanest solution. It’s a bit tricky, but it works, which it’s enough for me.
Thanks to the fast and useful wordpress support answer, that helped me to figure out how to override this behaviour.
Gráficas de uso de memoria de passenger con Munin
Estaba instalando algunos plugins adicionales en el munin para monitorizar el estado de las peticiones que entran por Apache.
He encontrado uno para monitorizar el uso de memoria pero se ha quedado anticuado con respecto a ciertos cambios que ha sufrido la salida del comando passenger-memory-stats. Por lo tanto ya no sirve.
Basándome en dicho plugin y en este otro, he hecho algunos cambios y el código resultante es el siguiente:
#!/usr/bin/env ruby
def output_config
puts <<-END
graph_category Passenger
graph_title passenger memory stats
graph_vlabel megabytes
apache_memory.label apache_memory
passenger_memory.label passenger_memory
END
exit 0
end
def output_values
memory_stats_command = '/usr/bin/passenger-memory-stats'
memory = {}
apache_header = "Apache processes"
passenger_header = "Passenger processes"
nginx_header = "Nginx processes"
section = nil
`#{memory_stats_command}`.each_line do |line|
if line.include?(apache_header)
section = "apache"
elsif line.include?(nginx_header)
section = "nginx"
elsif line.include?(passenger_header)
section = "passenger"
elsif /### Total private dirty RSS: (\d+\.\d+) MB/.match(line)
memory[section] = $1
else
next
end
end
puts "apache_memory.value #{memory['apache']}"
puts "passenger_memory.value #{memory['passenger']}"
#puts "nginx_memory.value #{memory['nginx']}"
end
if ARGV[0] == "config"
output_config
else
output_values
end
El plugin parsea los totales de memoria tanto de apache, como de nginx, como de apache passenger. En mi caso solo muestro los valores de apache y de passenger, pero si se quisiera mostrar los de nginx, bastaría con descomentar la linea:
puts "nginx_memory.value #{memory['nginx']}"