vShare Nginx Config

Here is Nginx Configuration for vShare youtube clone script

# enforce NO www
if ($host ~* ^www\.(.*))
{
	set $host_without_www $1;
	rewrite ^/(.*)$ https://$host_without_www/$1 permanent;
}


# main server
location / {

	## RewriteRule ^include/(.*) http://www.vshare.in

	rewrite	^/admin(.*)$				/index.php permanent;
	rewrite	^/admin/(.*)$				/index.php permanent;

	rewrite	^/install(.*)$				/index.php permanent;
	rewrite	^/install/(.*)$				/index.php permanent;

	rewrite	^/ubr(.*)$				/index.php permanent;
	rewrite	^/ubr/(.*)$				/index.php permanent;

	rewrite	^/cache/				/index.php permanent;
	rewrite	^/download/(.*)				/download.php?video_id=$1 last;

	rewrite	^/view/(.*)/(.*)/			/view_video.php?id=$1 last;
	rewrite	^/view/(.*)/(.*)			/view_video.php?id=$1 last;
	rewrite	^/view/(.*)/				/video_redirect.php?id=$1 last;
	rewrite	^/view/(.*)				/video_redirect.php?id=$1 last;

	rewrite	^/tag/(.*)/(.*)				/tag.php?search_string=$1&page=$2 last;
	rewrite	^/tags/					/tags.php last;

	rewrite	^/channels/				/channels.php last;
	rewrite	^/channels				/channels.php last;

	rewrite	^/upload/success/(.*)/(.*)/		/upload_success.php?id=$1&upload_id=$2 last;
	rewrite	^/upload/embed/				/upload_embed.php last;
	rewrite	^/upload/embed				/upload_embed.php last;
	rewrite	^/upload/				/upload.php last;
	rewrite	^/upload				/upload.php last;

	rewrite	^/channel/(.*)/(.*)/recent/(.*)/	/video.php?category=recent&chid=$1&page=$3 last;
	rewrite	^/channel/(.*)/(.*)/viewed/(.*)/	/video.php?category=viewed&chid=$1&page=$3 last;
	rewrite	^/channel/(.*)/(.*)/(.*)/(.*)		/video.php?chid=$1&category=$2&view_type=$3&page=$4 last;
	rewrite	^/channel/(.*)/(.*)			/channel_details.php?id=$1 last;

	rewrite	^/friends/recommend/(.*)/		/recommend_friends.php?video_id=$1 last;
	rewrite	^/friends/invite/			/invite_friends.php?username=$1&page=$2 last;
	rewrite	^/friends/(.*)				/friends.php?page=$1 last;

	rewrite	^/members/(.*)/(.*)/			/members.php?sort=$1&page=$2 last;
	rewrite	^/members/(.*)				/members.php?page=$1 last;

	rewrite	^/detailed/recent/(.*)			/video.php?category=recent&page=$1&view_type=detailed last;
	rewrite	^/detailed/viewed/(.*)			/video.php?category=viewed&page=$1&view_type=detailed last;
	rewrite	^/detailed/discussed/(.*)		/video.php?category=discussed&page=$1&view_type=detailed last;
	rewrite	^/detailed/favorites/(.*)		/video.php?category=favorites&page=$1&view_type=detailed last;
	rewrite	^/detailed/rated/(.*)			/video.php?category=rated&page=$1&view_type=detailed last;
	rewrite	^/detailed/featured/(.*)		/video.php?category=featured&page=$1&view_type=detailed last;

	rewrite	^/recent/(.*)				/video.php?category=recent&page=$1 last;
	rewrite	^/viewed/(.*)				/video.php?category=viewed&page=$1 last;
	rewrite	^/edit/video/(.*)			/video_edit.php?video_id=$1 last;
	rewrite	^/discussed/(.*)			/video.php?category=discussed&page=$1 last;
	rewrite	^/favorites/(.*)			/video.php?category=favorites&page=$1 last;
	rewrite	^/rated/(.*)				/video.php?category=rated&page=$1 last;
	rewrite	^/featured/(.*)				/video.php?category=featured&page=$1 last;

	rewrite	^/rss/new/				/rss.php?type=new last;
	rewrite	^/rss/comments/				/rss.php?type=comments last;
	rewrite	^/rss/views/				/rss.php?type=views last;

	rewrite	^/featured/(.*)				/video.php?category=featured&page=$1 last;

	rewrite	^/group/new/				/group_new.php last;
	rewrite	^/group/(.*)/join/(.*)			/group_invite_confirm.php?group_url=$1&key=$2 last;
	rewrite	^/group/(.*)/members/(.*)		/group_members.php?group_url=$1&page=$2 last;
	rewrite	^/group/(.*)/videos/(.*)		/group_videos.php?group_url=$1&page=$2 last;
	rewrite	^/group/(.*)/add/(.*)			/group_add_videos.php?group_url=$1&page=$2 last;
	rewrite	^/group/(.*)/fav/(.*)			/group_add_fav_videos.php?group_url=$1&page=$2 last;
	rewrite	^/group/(.*)/topic/(.*)			/group_postss.php?group_url=$1&topic_id=$2 last;
	rewrite	^/group/(.*)/invite/(.*)		/invite_members.php?group_url=$1 last;
	rewrite	^/group/(.*)/edit/(.*)			/group_edit.php?group_url=$1 last;
	rewrite	^/group/(.*)/				/group_home.php?group_url=$1 last;

	rewrite	^/groups/(.*)/(.*)/(.*)			/groups.php?chid=$1&page=$3 last;
	rewrite	^/groups/(.*)/(.*)			/groups.php?chid=$1&page=$2 last;

	rewrite	^/login/				/login.php last;
	rewrite	^/login					/login.php last;

	rewrite	^/logout/				/logout.php last;
	rewrite	^/logout				/logout.php last;

	rewrite	^/signup/				/signup.php last;
	rewrite	^/signup				/signup.php last;

	rewrite	^/family_filter/			/family_filter.php last;
	rewrite	^/family_filter				/family_filter.php last;

	rewrite	^/pages/(.*).html			/show_page.php?name=$1 last;

	rewrite	^/v/(.*)/				/video_embed.php?video_id=$1 last;
	rewrite	^/v/(.*)				/video_embed.php?video_id=$1 last;

	rewrite	^/verify/user/(.*)/(.*)/(.*)/		/user_signup_verify.php?u=$1&i=$2&k=$3 last;
	rewrite	^/verify/email/(.*)/(.*)/(.*)/		/confirm_email.php?u=$1&i=$2&k=$3 last;

	rewrite	^/confirm/friend/(.*)/(.*)		/friend_accept.php?id=$1&key=$2 last;

	rewrite	^/search/(.*)/(.*)			/search_videos.php?search_string=$1&page=$2 last;
	rewrite	^/search/(.*)				/search_videos.php?search_string=$1&page=1 last;

	rewrite ^/style/(.*)/				/style.php?css=$1 last;
	rewrite ^/style/(.*)				/style.php?css=$1 last;

	rewrite ^/privacy/				/user_privacy.php?css=$1 last;
	rewrite ^/password/				/password_change.php last;

	rewrite ^/video_response_upload/(.*)		/upload_video_response.php?vid=$1 last;
	rewrite ^/response/(.*)/videos/(.*)		/video_responses.php?video_id=$1&page=$2 last;
	rewrite ^/verify/response/(.*)/(.*)/(.*)/	/video_response_verify.php?u=$1&i=$2&k=$3 last;

	rewrite	^/([^/\.]+)/account/			/myaccount.php last;
	rewrite	^/([^/\.]+)/favorites/(.*)		/user_favorites.php?user_name=$1&page=$2 last;
	rewrite	^/([^/\.]+)/playlist/(.*)/(.*)		/user_playlist.php?user_name=$1&page=$2 last;
	rewrite	^/([^/\.]+)/playlist/(.*)		/user_playlist.php?user_name=$1&page=1 last;
	rewrite	^/([^/\.]+)/friends/videos/(.*)		/user_friends_videos.php?user_name=$1&page=$2 last;
	rewrite	^/([^/\.]+)/friends/favorites/(.*)	/user_friends_favourites.php?user_name=$1&page=$2 last;
	rewrite	^/([^/\.]+)/friends/(.*)		/user_friends.php?user_name=$1&page=$2 last;
	rewrite	^/([^/\.]+)/pubic/(.*)$			/user_videos.php?user_name=$1&type=public&page=$2 last;
	rewrite	^/([^/\.]+)/private/(.*)$		/user_videos.php?user_name=$1&type=private&page=$2 last;
	rewrite	^/([^/\.]+)/groups/(.*)$		/user_groups.php?user_name=$1&page=$2 last;
	rewrite	^/([^/\.]+)/edit/(.*)$			/user_profile_edit.php?user_name=$1 last;
	rewrite	^/([^/\.]+)/unsubscribe/(.*)$		/email_unsubscribe.php?user_name=$1&vkey=$2 last;


	# Just in case we missed something :)
	error_page	404	/index.php?src=404;
	try_files	$uri	$uri/	=404;
}

https://gist.github.com/serverok/1b300ff880db6aca59de0e42d86dadcb

https://www.vshare.in

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *