{"id":2451,"date":"2023-12-15T20:01:08","date_gmt":"2023-12-15T20:01:08","guid":{"rendered":"https:\/\/www.clientvps.com\/docs\/?p=2451"},"modified":"2024-03-12T21:03:20","modified_gmt":"2024-03-12T21:03:20","slug":"change-port-for-a-web-service-e-g-apache-or-nginx","status":"publish","type":"post","link":"https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/","title":{"rendered":"Change Port for a Web Service (e.g., Apache or Nginx)"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">1. Apache HTTP Server:<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open the Apache configuration file in a text editor. The default configuration file is usually located at <code>\/etc\/apache2\/sites-available\/000-default.conf<\/code>.bashCopy code<code>sudo nano \/etc\/apache2\/sites-available\/000-default.conf<\/code><\/li>\n\n\n\n<li>Find the line that begins with <code>VirtualHost *:80<\/code> (or similar). Change <code>80<\/code> to your desired port, for example, <code>8080<\/code>.apacheCopy code<code>&lt;VirtualHost *:8080&gt;<\/code><\/li>\n\n\n\n<li>Save the file and exit the text editor.<\/li>\n\n\n\n<li>Restart Apache to apply the changes.bashCopy code<code>sudo service apache2 restart<\/code><\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\">2. Nginx:<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open the Nginx configuration file in a text editor. The default configuration file is usually located at <code>\/etc\/nginx\/sites-available\/default<\/code>.bashCopy code<code>sudo nano \/etc\/nginx\/sites-available\/default<\/code><\/li>\n\n\n\n<li>Find the line that begins with <code>listen 80<\/code>. Change <code>80<\/code> to your desired port, for example, <code>8080<\/code>.nginxCopy code<code>listen 8080 default_server;<\/code><\/li>\n\n\n\n<li>Save the file and exit the text editor.<\/li>\n\n\n\n<li>Restart Nginx to apply the changes.bashCopy code<code>sudo service nginx restart<\/code><\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Change Port for a Custom Application<\/h3>\n\n\n\n<p>If you&#8217;re running a custom application, you may need to check its documentation for instructions on how to change the listening port. In general, you&#8217;ll need to find and edit the configuration file for the application.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Firewall Configuration<\/h3>\n\n\n\n<p>If you&#8217;re changing to a non-default port, ensure that the firewall allows traffic on the new port. For example, if using UFW:<\/p>\n\n\n\n<p>bashCopy code<\/p>\n\n\n\n<p><code>sudo ufw allow 8080 sudo ufw reload<\/code><\/p>\n\n\n\n<p>Replace <code>8080<\/code> with your chosen port.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Test the Changes<\/h3>\n\n\n\n<p>After making these changes, you can test the new port by accessing your website using the new port number in the URL (e.g., <code>http:\/\/yourdomain.com:8080<\/code>).<\/p>\n\n\n\n<p>Please note that it&#8217;s important to choose a port that is not already in use and is not reserved for other purposes. Common alternative ports include <code>8080<\/code>, <code>8000<\/code>, or any number above 1024.<\/p>\n\n\n\n<p>Remember to update your website configurations accordingly, especially if you have any reverse proxy settings or load balancers involved.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Apache HTTP Server: 2. Nginx: Change Port for a Custom Application If you&#8217;re running a custom application, you may need to check its documentation for instructions on how to change the listening port. In general, you&#8217;ll need to find and edit the configuration file for the application. Firewall Configuration If you&#8217;re changing to a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2521,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2451","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux-servers"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Change Port for a Web Service (e.g., Apache or Nginx)<\/title>\n<meta name=\"description\" content=\"Quickly enhance your web service security by changing its port. Our guide simplifies port adjustment for Apache\/Nginx, reducing exposure to common threats.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Change Port for a Web Service (e.g., Apache or Nginx)\" \/>\n<meta property=\"og:description\" content=\"Quickly enhance your web service security by changing its port. Our guide simplifies port adjustment for Apache\/Nginx, reducing exposure to common threats.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/\" \/>\n<meta property=\"og:site_name\" content=\"ClientVPS Hosting Documentation Blog\" \/>\n<meta property=\"article:published_time\" content=\"2023-12-15T20:01:08+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-12T21:03:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.clientvps.com\/docs\/wp-content\/uploads\/2023\/12\/apache-changeport.png\" \/>\n\t<meta property=\"og:image:width\" content=\"500\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Edna Deleon\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Edna Deleon\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/\"},\"author\":{\"name\":\"Edna Deleon\",\"@id\":\"https:\/\/www.clientvps.com\/docs\/#\/schema\/person\/2bcacf1f391ca24e8f469abdbaf1ccc7\"},\"headline\":\"Change Port for a Web Service (e.g., Apache or Nginx)\",\"datePublished\":\"2023-12-15T20:01:08+00:00\",\"dateModified\":\"2024-03-12T21:03:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/\"},\"wordCount\":266,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.clientvps.com\/docs\/#organization\"},\"articleSection\":[\"Linux Server\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/\",\"url\":\"https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/\",\"name\":\"Change Port for a Web Service (e.g., Apache or Nginx)\",\"isPartOf\":{\"@id\":\"https:\/\/www.clientvps.com\/docs\/#website\"},\"datePublished\":\"2023-12-15T20:01:08+00:00\",\"dateModified\":\"2024-03-12T21:03:20+00:00\",\"description\":\"Quickly enhance your web service security by changing its port. Our guide simplifies port adjustment for Apache\/Nginx, reducing exposure to common threats.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.clientvps.com\/docs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Change Port for a Web Service (e.g., Apache or Nginx)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.clientvps.com\/docs\/#website\",\"url\":\"https:\/\/www.clientvps.com\/docs\/\",\"name\":\"ClientVPS Documentation\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.clientvps.com\/docs\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.clientvps.com\/docs\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.clientvps.com\/docs\/#organization\",\"name\":\"ClientVPS Documentation\",\"url\":\"https:\/\/www.clientvps.com\/docs\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.clientvps.com\/docs\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.clientvps.com\/docs\/wp-content\/uploads\/2023\/12\/cropped-footer-logo.webp\",\"contentUrl\":\"https:\/\/www.clientvps.com\/docs\/wp-content\/uploads\/2023\/12\/cropped-footer-logo.webp\",\"width\":328,\"height\":127,\"caption\":\"ClientVPS Documentation\"},\"image\":{\"@id\":\"https:\/\/www.clientvps.com\/docs\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.clientvps.com\/docs\/#\/schema\/person\/2bcacf1f391ca24e8f469abdbaf1ccc7\",\"name\":\"Edna Deleon\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.clientvps.com\/docs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/87e4d7f8bc1ce983b427e235829628aec7ca0659559209e6e9b3dc9966a5b42c?s=96&d=robohash&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/87e4d7f8bc1ce983b427e235829628aec7ca0659559209e6e9b3dc9966a5b42c?s=96&d=robohash&r=g\",\"caption\":\"Edna Deleon\"},\"sameAs\":[\"https:\/\/www.clientvps.com\/docs\"],\"url\":\"https:\/\/www.clientvps.com\/docs\/author\/admin2\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Change Port for a Web Service (e.g., Apache or Nginx)","description":"Quickly enhance your web service security by changing its port. Our guide simplifies port adjustment for Apache\/Nginx, reducing exposure to common threats.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/","og_locale":"en_US","og_type":"article","og_title":"Change Port for a Web Service (e.g., Apache or Nginx)","og_description":"Quickly enhance your web service security by changing its port. Our guide simplifies port adjustment for Apache\/Nginx, reducing exposure to common threats.","og_url":"https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/","og_site_name":"ClientVPS Hosting Documentation Blog","article_published_time":"2023-12-15T20:01:08+00:00","article_modified_time":"2024-03-12T21:03:20+00:00","og_image":[{"width":500,"height":400,"url":"https:\/\/www.clientvps.com\/docs\/wp-content\/uploads\/2023\/12\/apache-changeport.png","type":"image\/png"}],"author":"Edna Deleon","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Edna Deleon","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/#article","isPartOf":{"@id":"https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/"},"author":{"name":"Edna Deleon","@id":"https:\/\/www.clientvps.com\/docs\/#\/schema\/person\/2bcacf1f391ca24e8f469abdbaf1ccc7"},"headline":"Change Port for a Web Service (e.g., Apache or Nginx)","datePublished":"2023-12-15T20:01:08+00:00","dateModified":"2024-03-12T21:03:20+00:00","mainEntityOfPage":{"@id":"https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/"},"wordCount":266,"commentCount":0,"publisher":{"@id":"https:\/\/www.clientvps.com\/docs\/#organization"},"articleSection":["Linux Server"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/","url":"https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/","name":"Change Port for a Web Service (e.g., Apache or Nginx)","isPartOf":{"@id":"https:\/\/www.clientvps.com\/docs\/#website"},"datePublished":"2023-12-15T20:01:08+00:00","dateModified":"2024-03-12T21:03:20+00:00","description":"Quickly enhance your web service security by changing its port. Our guide simplifies port adjustment for Apache\/Nginx, reducing exposure to common threats.","breadcrumb":{"@id":"https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.clientvps.com\/docs\/change-port-for-a-web-service-e-g-apache-or-nginx\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.clientvps.com\/docs\/"},{"@type":"ListItem","position":2,"name":"Change Port for a Web Service (e.g., Apache or Nginx)"}]},{"@type":"WebSite","@id":"https:\/\/www.clientvps.com\/docs\/#website","url":"https:\/\/www.clientvps.com\/docs\/","name":"ClientVPS Documentation","description":"","publisher":{"@id":"https:\/\/www.clientvps.com\/docs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.clientvps.com\/docs\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.clientvps.com\/docs\/#organization","name":"ClientVPS Documentation","url":"https:\/\/www.clientvps.com\/docs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.clientvps.com\/docs\/#\/schema\/logo\/image\/","url":"https:\/\/www.clientvps.com\/docs\/wp-content\/uploads\/2023\/12\/cropped-footer-logo.webp","contentUrl":"https:\/\/www.clientvps.com\/docs\/wp-content\/uploads\/2023\/12\/cropped-footer-logo.webp","width":328,"height":127,"caption":"ClientVPS Documentation"},"image":{"@id":"https:\/\/www.clientvps.com\/docs\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.clientvps.com\/docs\/#\/schema\/person\/2bcacf1f391ca24e8f469abdbaf1ccc7","name":"Edna Deleon","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.clientvps.com\/docs\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/87e4d7f8bc1ce983b427e235829628aec7ca0659559209e6e9b3dc9966a5b42c?s=96&d=robohash&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/87e4d7f8bc1ce983b427e235829628aec7ca0659559209e6e9b3dc9966a5b42c?s=96&d=robohash&r=g","caption":"Edna Deleon"},"sameAs":["https:\/\/www.clientvps.com\/docs"],"url":"https:\/\/www.clientvps.com\/docs\/author\/admin2\/"}]}},"_links":{"self":[{"href":"https:\/\/www.clientvps.com\/docs\/wp-json\/wp\/v2\/posts\/2451","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.clientvps.com\/docs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.clientvps.com\/docs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.clientvps.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.clientvps.com\/docs\/wp-json\/wp\/v2\/comments?post=2451"}],"version-history":[{"count":0,"href":"https:\/\/www.clientvps.com\/docs\/wp-json\/wp\/v2\/posts\/2451\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.clientvps.com\/docs\/wp-json\/wp\/v2\/media\/2521"}],"wp:attachment":[{"href":"https:\/\/www.clientvps.com\/docs\/wp-json\/wp\/v2\/media?parent=2451"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.clientvps.com\/docs\/wp-json\/wp\/v2\/categories?post=2451"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.clientvps.com\/docs\/wp-json\/wp\/v2\/tags?post=2451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}