LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-06-2014, 04:49 PM   #1
bentman78
Member
 
Registered: Mar 2003
Location: Washington DC, USA
Distribution: Redhat
Posts: 212

Rep: Reputation: 30
Issue when changing port on NGINX server config file


I have an NGINX config issue where I'm trying to move the port from 80 to 8080. Bearing in mind I have iptables turned off and nothing is being written to the log files, when I switch the ports from 80 to 8080 I cannot connect. Here is a sample of my config:
Code:
    server {
    # Configure the domain that will run WordPress
    server_name xxxxxxx.xxxxxxx;
    #listen 8080;
    listen 80;
    port_in_redirect off;
    server_tokens off;
    autoindex off;
    error_log /var/log/nginx/xxxxxxx.error_log;
    client_max_body_size 15m;
    client_body_buffer_size 128k;

    
    root /home/websites/xxxxxx_me/public;
    index index.html index.htm index.php;
    #try_files $uri $uri/ /index.php?q=$uri&$args;
    try_files $uri $uri/ /index.php;
    # Define default caching of 24h
    expires 86400s;
    add_header Pragma public;
    add_header Cache-Control "max-age=86400, public, must-revalidate, proxy-revalidate";

    # deliver a static 404
    error_page 404 /404.html;
    location  /404.html {
        internal;
    }

    # Deliver 404 instead of 403 "Forbidden"
    error_page 403 = 404;

    # Do not allow access to files giving away your WordPress version
    location ~ /(\.|wp-config.php|readme.html|licence.txt) {
        return 404;
    }

    # Add trailing slash to */wp-admin requests.
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;

    # Don't log robots.txt requests
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    # Rewrite for versioned CSS+JS via filemtime
    location ~* ^.+\.(css|js)$ {
        rewrite ^(.+)\.(\d+)\.(css|js)$ $1.$3 last;
        expires 31536000s;
        access_log off;
        log_not_found off;
        add_header Pragma public;
        add_header Cache-Control "max-age=31536000, public";
    }

    # Aggressive caching for static files
    # If you alter static files often, please use
    # add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate";
    location ~* \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|ogv|otf|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|t?gz|tif|tiff|ttf|wav|webm|wma|woff|wri|xla|xls|xlsx|xlt|xlw|zip)$ {expires 31536000s;
        access_log off;
        log_not_found off;
        add_header Pragma public;
        add_header Cache-Control "max-age=31536000, public";
    }
    # pass PHP scripts to Fastcgi listening on Unix socket
    # Do not process them if inside WP uploads directory
    # If using Multisite or a custom uploads directory,
    # please set the */uploads/* directory in the regex below
    location ~* (^(?!(?:(?!(php|inc)).)*/uploads/).*?(php)) {
        try_files $uri = 404;
        fastcgi_split_path_info ^(.+.php)(.*)$;
        fastcgi_pass unix:/var/run/php-fpm/xxxxxx.socket;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        fastcgi_intercept_errors on;
        fastcgi_ignore_client_abort off;
        fastcgi_connect_timeout 60;
        fastcgi_send_timeout 180;
        fastcgi_read_timeout 180;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 4 256k;}

      # Deny access to hidden files
      location ~ /\. {
        deny all;
        access_log off;
        log_not_found off;
    }

    }

    # Redirect all www. queries to non-www
    # Change in case your site is to be available at "www.yourdomain.tld"
    server {
    #listen 8080;
    listen 80;
    server_name www.xxxxxxx.xxxxxxx;
    rewrite ^ $scheme://xxxxxxx.xxxxxxx$request_uri? permanent;
    }
Keep in mind it works great under port 80, just not 8080. I'm really thrown for a loop here. Thanks in advance.
 
Old 03-06-2014, 07:18 PM   #2
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,979
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
What OS are you running on? Is SELinux coming into play?
 
Old 03-06-2014, 10:02 PM   #3
bentman78
Member
 
Registered: Mar 2003
Location: Washington DC, USA
Distribution: Redhat
Posts: 212

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by custangro View Post
What OS are you running on? Is SELinux coming into play?
centos. I don't think there is any selinux policies for NGINX. In any case, I put it into permissive and still a no go. Thanks though.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
chmod: changing permissions of `/usr../bin': Read-only file File System Issue cdhar Linux - Newbie 3 12-31-2012 07:17 AM
Getting an error while changing sendmail config file... pinenut Linux - Server 3 11-11-2009 11:15 AM
Changing httpd config file NhaldSev Linux - Software 4 01-11-2007 02:04 AM
Looking for port config file GreenerLinux Debian 4 02-02-2004 12:23 PM
Changing Xf86 config file toosdedoos Linux - Newbie 1 09-26-2003 10:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration