vhost on nginx

1 min read

|| how to setup vhost on nginx
+ create directory for vhost

 # cd /var/www
# mkdir -p blackonsole.org/{htdocs,logs,stats}
# mkdir -p blackonsole.com/{htdocs,logs,stats}

+ create vhost conf file

 # vi /etc/nginx/conf.d/blackonsole.org.conf
server {
   listen  80;
   server_name  blackonsole.org www.blackonsole.org;

   access_log  /var/www/blackonsole.org/logs/access.log ;
   error_log	/var/www/blackonsole.org/logs/error.log ;

   location / {
       root   /var/www/blackonsole.org/htdocs;
       index  index.php index.html index.htm;

   }

   error_page   500 502 503 504  /50x.html;
   location = /50x.html {
       root   /var/www/blackonsole.org/htdocs;
   }

  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  location ~ .php$ {
		fastcgi_pass   127.0.0.1:9000;
		fastcgi_index  index.php;
		root	/var/www/blackonsole.org/htdocs;
		fastcgi_param  SCRIPT_FILENAME  /var/www/blackonsole.org/htdocs$fastcgi_script_name;
		include fastcgi_params;
	}


   location ~ /.ht {
       deny  all;
   }
}
 # vi /etc/nginx/conf.d/blackonsole.com.conf
server {
   listen  80;
   server_name  blackonsole.com www.blackonsole.com;

   access_log  /var/www/blackonsole.com/logs/access.log ;
   error_log	/var/www/blackonsole.com/logs/error.log ;

   location / {
       root   /var/www/blackonsole.com/htdocs;
       index  index.php index.html index.htm;

   }

   error_page   500 502 503 504  /50x.html;
   location = /50x.html {
       root   /var/www/blackonsole.com/htdocs;
   }

  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  location ~ .php$ {
		fastcgi_pass   127.0.0.1:9000;
		fastcgi_index  index.php;
		root	/var/www/blackonsole.com/htdocs;
		fastcgi_param  SCRIPT_FILENAME  /var/www/blackonsole.com/htdocs$fastcgi_script_name;
		include fastcgi_params;
	}

   location ~ /.ht {
       deny  all;
   }
}

+ add vhost on nginx.conf

# vi /etc/nginx/nginx.conf
### add line like this on http section:
include /etc/nginx/conf.d/*.conf;

+ restarting nginx httpd and php-fpm

 # /etc/init.d/php-fpm restart
# /etc/init.d/nginx restart

How to fix problem with the editor ‘vi’

:: git error with vi error: There was a problem with the editor 'vi'   :: how to fix the problem 0. check path...
sysadmin.id
10 sec read

Apache :: MP4 Streaming

:: How to Enable mp4 Streaming in Apache + Installing mod h624 streaming wget //h264.code-shop.com/download/apache_mod_h264_streaming-2.2.7.tar.gz tar -xzf apache_mod_h264_streaming-2.2.7.tar.gz cd mod_h264_streaming-2.2.7/ ./configure --with-apxs=`which apxs2` make...
sysadmin.id
18 sec read

Apache :: Flash / FLV Streaming

:: How to Configure Apache for FLV Streaming + Installing mod_flvx wget //people.apache.org/~pquerna/modules/mod_flvx.c which apxs /usr/bin/apxs /usr/bin/apxs -cia mod_flvx.c + setup mod_flvx in http.conf...
sysadmin.id
15 sec read