0

I am currently trying to get my Nginx+Mysql+Wordpress work on Fedora 18 x64.

Did the following manual http://www.tecmint.com/install-wordpress-using-lamp-or-lemp-on-rhel-centos-fedora/ but nothing seems to work.

Default Nginx greeting is still displayed at localhost:80.

Should i provide some configuration files as examples?

Please help i am really lost. Google'd everything, reading official Nginx manuals atm.

# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log;
#error_log  /var/log/nginx/error.log  notice;
#error_log  /var/log/nginx/error.log  info;

pid        /run/nginx.pid;


events {
worker_connections  1024;
}


http {
include       /usr/local/etc/nginx/sites-enabled/*;
include       mime.types;

default_type  application/octet-stream;

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_x_forwarded_for"';

access_log  /var/log/nginx/access.log  main;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;

#gzip  on;

server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;

    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        root   /srv/www/wordpress/public_html;
        index  index.php index.html;
    }

    # redirect server error pages to the static page /40x.html
    #
    error_page  404              /404.html;
    location = /40x.html {
        root   /usr/share/nginx/html;
    }

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

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

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
#    listen       8000;
#    listen       somename:8080;
#    server_name  somename  alias  another.alias;

#    location / {
#        root   html;
#        index  index.html index.htm;
#    }
#}


# HTTPS server
#
#server {
#    listen       443;
#    server_name  localhost;

#    ssl                  on;
#    ssl_certificate      cert.pem;
#    ssl_certificate_key  cert.key;

#    ssl_session_timeout  5m;

#    ssl_protocols  SSLv2 SSLv3 TLSv1;
#    ssl_ciphers  HIGH:!aNULL:!MD5;
#    ssl_prefer_server_ciphers   on;

#    location / {
#        root   html;
#        index  index.html index.htm;
#    }
#}

}
3
  • Can you edit your post with the nginx config for your wordpress site? Commented Feb 13, 2013 at 19:03
  • I haven't really touched nginx.conf file since it is not mentioned in the manual. Commented Feb 13, 2013 at 19:07
  • I just realized, should i first do this tecmint.com/… guide and then jump on the one i linked in the main post. Commented Feb 13, 2013 at 19:08

1 Answer 1

4

Below is my nginx config for one of my Wordpress sites, minus the domain name and IP address, of course... I built this one using many references online, and it seems to work pretty well.

server {
  listen <ip-address>;
  server_name domain.com;
  rewrite ^(.*) $scheme://www.domain.com$request_uri? permanent;
}

server {
  listen <ip-address>;
  server_name www.domain.com; 
  root   /www/domain.com/public_html;

  access_log /www/domain.com/logs/access.log;
  error_log /www/domain.com/logs/error.log;

  location = /favicon.ico {
  log_not_found off;
  access_log off;
  }

  location = /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
  }

  location / {
    index  index.html index.htm index.php;
    try_files $uri $uri/ /index.php;
  }

  location ~ \.php$ {
    include /etc/nginx/fastcgi_params;
    if ($uri !~ "^/images/") {
      fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket;
    }
    fastcgi_index index.php;
    fastcgi_param  SCRIPT_FILENAME  /www/domain.com/public_html$fastcgi_script_name;
  }

  location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
    expires max;
    log_not_found off;
  }
}
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your time gonna try it tomorrow. Cheers.
Great! If it doesn't work, feel free to message me or post back here and we'll keep working through it. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.