How can I run wordpress php files in a subdomain?

Solution:

To configure wordpress subdomain as you need:

1) configure the virtualhost, example

<VirtualHost *:80>
ServerAdmin you@domain.com
DocumentRoot "/var/www/blog/"
ServerName blog.domain.com
ErrorLog "/var/log/blog.domain.com-error_log"
CustomLog "/var/log/blog.domain.com-access_log" common
<Directory "/var/www/blog/">
    Options +Includes
    AllowOverride all
</Directory>

 

2) Configure wordpress to use the subdomain:

Place the following line of code to the end of the file wp-config.php

define('WP_HOME', 'http://blog.domain.com');
define('WP_SITEURL', 'http://blog.domain.com');